Other issues

Allowed memory size exceeded

Required for installation: YES

By default, PHP is usually installed with a memory limit of 16MB that any PHP script may consume. working to get this below 32MB.

Sample error message

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 16 bytes) in /home/jamilatta/project/submission/htdocs/classes/xml/XMLNode.inc.php on line 42

Solutions

On a hosted server, no root access

Ask your hosting provider to increase PHP's allowed memory size to 64MB or more.

Local php.ini file

Some web hosts allow placing a php.ini file in your local web directory to override the default site settings.

memory_limit = 64M;

On a personal web server, a VPS, or a shared server with root access

  1. Locate the php.ini file used by your web server:
    • On a linux system you can try the commands:

$ locate php.ini

or

$ find / -name php.ini

  • You may find several php.ini files, you want to edit the file in the cgi or apache directory (depending on whether PHP is running as a CGI or mod_php).
  • You can also use phpinfo() in a file to display a list of php.ini settings, including the current location of your php.ini file.
  1. Open your php.ini file with your favorite text editor
    • Make sure to open the file with su privileges (use sudo if avaiable)
  2. Edit the line below and set the memory limit to 64M:

memory_limit = 64M ; Maximum amount of memory a script may consume (16MB)

  1. Save your changes to php.ini
  2. Restart your Apache process (only necessary if PHP is running as an Apache module):

$ apache2ctl restart

Resource limits section in a typical php.ini file

Resource Limits

max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 32M ; Maximum amount of memory a script may consume (16MB)