Change the Memory Limit for PHP Scripts

WARNING: Always make a backup of php.ini before making changes to it.

If you are doing this as root, you do not need to use 'sudo' at the beginning of the commands.

  1. Open your php.ini file. (Most often it is in the /etc/ directory)
sudo nano /etc/php.ini
  1. Locate the following setting:
memory_limit '' 8M ; Maximum amount of memory a script may consume (8MB)
  1. Replace the '8M' with the desired setting, ie Cacti recommends 512M or better.
  2. Press 'Ctrl+O' and then 'Enter'.
  3. Press 'Ctrl+X' to exit.
  4. Restart Apache Server with the following command:
sudo /etc/init.d/httpd restart

– Main.FredPettis - 02 Jun 2009