Site broke and unable to edit page with Elementor when updating Elementor to version 3.19.0 - View Article


How to Increase the PHP Memory Limit

1. Edit your wp-config.php file

Wp-config.php is one of the most important WordPress files because it contains your base configuration details. You’ll find it in the root of your WordPress file directory.

To edit the memory limit and upload limit, look for this line:

define('WP_MEMORY_LIMIT', '32M');

Modify the second parameter by increasing it. As I mentioned a PHP memory limit of 128M should be more than enough.

define('WP_MEMORY_LIMIT', '128M');

Save the file and you’re done. You may need to increase it again if you’re still getting the fatal error, but don’t go overboard or you may crash your server. All the more reason to reach out to your host for help.

If you’re running into a memory limit fatal error in the admin area of WordPress, then you’ll need to modify a different line in your wp-config.php file.

To increase the WP memory limit for the administration area look for this line and increase it:

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Admin tasks require more memory, so you’ll need to set it much higher. Double the number you set for WP_Memory_Limit.

2. Edit your PHP.ini file

In the event that modifying your wp-config.php file doesn’t address the problem, you’ll have to address the issue within your server settings instead of within WordPress.

If you’re using shared hosting, you will not be able to access your PHP.ini file, so see the next option instead. If you do have access to PHP.ini, you’ll most likely find it in the root folder, but the location of the file will vary by host.

To increase the PHP memory limit and upload limit, change these lines in PHP.ini

memory_limit = 256M
upload_max_filesize = 12M
post_max_size = 13M
file_uploads = On
max_execution_time = 180

Changing the value of max_execution_time will limit the amount of time for a PHP script to run. If the PHP script exceeds the set value (seconds), it will stop the script and report an error.

In many cases, the values you enter should get larger as you go down the list from lines one to three. The upload_max_filesize should be the smallest while memory_limit should be the largest. The median should be post_max_size.

Before checking to see if the error is gone, clear your browser’s cache.

3. Edit your .htaccess file

If you don’t have access to PHP.ini, then your last resort is to modify your .htaccess file. Your .htaccess file starts with a dot because it is a hidden file. If you don’t see it in your root folder, check to make sure that your SFTP file manager isn’t keeping those files hidden from view.

To increase the PHP memory, you’ll add the following to your .htaccess file:

php_value memory_limit 256M
php_value upload_max_filesize 12M
php_value post_max_size 13M

If the PHP value memory limit has already been set, then increase it.