How to change PHP memory limit in Linux server?
In this article, I have tried to explain how you can increase the default memory limit to run your PHP application. The default PHP memory limit in cPanel will be 64 MB. Users may receive below type of errors in running PHP application which require more PHP memory than default 64 MB.
You can increase the default PHP memory limit value from “PHP configuration Editor” option of WHM. You will find “memory_limit” directive in core section. Just increase the limit from 64 MB to 256 MB (or any value in MB you wish). Click on Save button to submit the changes.
phpinfo();
?>
Once you got the exact path open it with any file editor tool like vi, pico or nano. I am using vi editor and find it more comfortable. So type below command once you are in /usr/local/lib directory:
Note: I would recommend to backup the existing php.ini file before you make any changes. Since if by mistake you will mess it then it may lead to stop your PHP functioning. So simply copy existing php.ini file somewhere and then start editing the existing one.
You will find “memory_limit” directive inside “Resource Limit” section. Just modify this value to the limit you wish to set and save exising php.ini file. In vi editor Press Esc -> colon (:) -> wq to save the file.
You will need to restart your apache server in order to make the changes effective. You can restart it by executing following command through SSH:
apachectl -k restart
Simply check phpinfo.php file and make sure the changes are reflected properly.
Thanks!
Rate This Article
Add comment
Quick search
Request a Quote
If you wish to receive proposals from Web Hosting Companies Suited to your needs.



