- Tutorial And Guides
- How To Change Memory Limit in Your PHP Apache Server
this is a step by step tutorial guide that will help you change the memory limit settings on your php server to allow more memory on your scripts , Last Updated: Sun Jun 14, 2020
Fri Jul 21, 2006
In this tutorial, I will show you how to change the memory limit in php. The default memory is set for 8M, but sometimes webmaster and admins need to change this to make their website faster.
- Always Make a backup file of php.ini before you start to do anythingn like this. If you dont know what you are doing, these changes could make your website go down. Please Read Disclaimer
1. If you dont know what your php settings are. See the post on this link;
2. If your memory is set to 8M, continue with next step
3. Open your php.ini file. If your server is a Webune Dedicated Server with Redhat, Centos or Fedora, you can run the following command to edit the php.ini file:
If you don't know where your php.ini file is, go back to step 1, the phpinfo.php file will show you where the pnp.ini file is at.
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)Replace With
memory_limit = 16M ; Maximum amount of memory a script may consume (8MB)
Basically I changed 8 to 16
5. Save file by hitting Control+x -then you will be asked if you want to save changes, type the letter y for yes
6. Then hit Return at the next prompt.
7. Restart Apache Server with the following command
NOTE: if you dont access to your server. for example, you have shared hosting, you can just set the configuration using the ini_set('memory_limit', '100m');
for more information about this, see reply #122244 by deter
8. Do step 1 again, and this time your phpinfo.php file should show 16M instead of 8M