Changing PHP memory limits

There are a number of ways to increase the PHP memory limit on your server, however you only need to use one of these techniques dependant on your server's configuration.

The typical memory limit for running a Joomla site on your server might be 128MB, but for sites that use a lot of extensions or with high memory pages you might find that 256MB is a more appropriate upper limit.

The relationship between scalability and PHP memory limit

An increase in the amount of memory that each PHP process can use will lead to a decrease in the maximum number of concurrent process that the server can run. The maximum number of page request that a server can process at any one time is linked to the number of concurrent processes that are running, the more processes that are running the less page requests that can be served.

The following example is for a server with 4GB of available memory for PHP processes (after accounting for the server's other processes such as the operating system, Apache, etc.)

PHP memory limit 128MB 256MB 512MB
Maximum number of concurrent processes 32 16 8

How to change PHP memory limits

Your web server's PHP.ini

If you have access to the server's PHP ini file then this is the recommended approach for changing the PHP memory limit. This method may not be possible for some shared hosting environments, although the hosting provider might be able to make the adjustment for you. In all cases this method will affect all websites running on the server.

  1. Find the server's php.ini file
  2. Look for the PHP memory limit memory_limit = 55M; Maximum amount of memory a script may consume (55MB) Note always use "M" to specify the number of megabytes, not "MB". If the memory limit line is not already present in your PHP.ini file then add it at the end of the file.
  3. Restart Apache

If PHP is running as CGI/FastCGI

If PHP is running on your server as CGI/FastCGI then you can add a php.ini file to your Joomla root folder. Add the following line to this php.ini file: memory_limit = 55M

PHP 5.3 and up

PHP 5.3+ allows you to change the memory limit by placing a .user.ini file in the website's public_html folder, some cPanel hosts will only allow this method.Add the following line to this .user.ini file: memory_limit = 55M

.htaccess

This method only worls if PHP is running as an Apache module on your server.

Edit the .htaccess file in the Joomla root folder and add the following line at the end of the file: php_value memory_limit 55M

Shared hosting environments

Access to the PHP memory limit setting is restricted in some shared hosting environments. If you cannot make adjustments to the php.ini file yourself, please ask your hosting provider to make the adjustment for you.

Modifying php.ini in XAMPP/WAMP or MAMP

If you are running XAMPP or WAMP as your localhost server then there may be two php.ini files, one in the PHP directory and the other in the Apache/bin directory. To change the memory limit edit the php.ini file that is found in the Apache/bin directory.

If you are running MAMP or MAMP Pro as your localhost then the php memory limit will be set at the PHP default of 8MB. To adjust the memory limit open the php.ini file and change the limit in the following line: memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)

You will find the php.ini file in the /Applications/MAMP/conf/php5/ directory and/or in the /Applications/MAMP/conf/php7/ directory.

In MAMP Pro you don't edit the php.ini file directly as it is rewritten each time the server starts up. To edit the php memory limit for MAMP Pro please edit the appropriate template instead (File > Edit Template > ...)

Test that your changes worked

Whenever you make a change to your php.ini file you can check that the changes worked by visiting your Joomla site's admin area and selecting the PHP Information tab from System > System Information in the top menu. On the PHP Information tab look for the row that contains the memory_limit information.