LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 11-28-2016, 03:42 AM   #1
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Rep: Reputation: Disabled
php - changing memory size limit


hi all,

i have found where you can change the memory size here -

; Maximum amount of memory a script may consume (128MB)
; http://www.php.net/manual/en/ini.cor...i.memory-limit
memory_limit = 128M

but i dont know what to set it to

i need to change it as when i run a script that uses php it complains it runs out of memory

thanks,

rob
 
Old 11-28-2016, 08:29 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Ideally the php application should have some indication of acceptable limits.

For example this Drupal page talks about php for their setup:
https://www.drupal.org/docs/7/managi...-memory-limits

Failing that a usual tuning technique is to do increases until it works without complaint. e.g. Double to 256m, restart and see if that helps. If not try 512m and repeat. Once you find an upper level that works you can try intermediate values if allowed.

Obviously there is a physical limit to this kind of thing. You would not want to set PHP to take ALL the physical memory (e.g. 8 GB) in your system even if this app is the only thing you intend to run as it wouldn't allow any memory for system processes. If you're running other apps you'd want to make sure you're not allocating so much memory to PHP that those other apps are starved for memory.

Also some programs are poorly written and/or have memory leaks (e.g. much Java) so it is possible the app would simply use as much memory as you have and then still complain. If this is the case, the fix is to adjust the app itself so it doesn't have that flaw any longer.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Virtual Memory limit exhausted at 1TB? malloc/mmap failures even with free memory mfkraft Linux - Server 2 09-16-2012 08:27 AM
php memory limit Basher52 Linux - Software 8 03-02-2012 12:39 PM
How to Limit suphp user memory limit? Rundi Linux - Server 2 05-14-2010 12:27 PM
changing video card memory size from root command line tallboy Linux - Hardware 6 04-04-2005 03:20 PM
Shared memory size limit? nodger Programming 1 03-16-2005 08:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration