Many common issues that you may run into such as: white screen, demo content fails when importing, message “Fatal error: Allowed memory size of xxxxxx bytes exhausted” empty page content and other similar issues… are all related to low PHP configuration limits. The solution is to increase the PHP limits. You can do this by your own by following these steps as below:
Change the memory limit in your php.ini
To fix the Allowed memory size exhausted error, we need to increase the memory limit. This memory_limit can be changed in the php.ini in the public_html folder in your hosting account. This error can creep up in your website during the normal development process.
Step 1: Login to your cPanel
Step 2: Go to the File Manager.
Select the Web root (public_html/www) directory and click Go.
Step 3: Find the php.ini file in the public_html.
Note: If you do not have a php.ini in your public_html files, you can have our tech support staff restore the php.ini to your public_html directory.
Open the php.ini with the code editor.
Step 4: Find the following section in the php.ini file, then increase those limits to a minimum as follows:
- max_input_vars = 3000
- memory_limit = 128M
- max_execution_time = 300
- max_input_time = 300
- upload_max_filesize = 64M
- post_max_size = 64M
Save the changes.
Step 5: In order for your memory limit to take effect you will need to make the php.ini recursive.
Making your php.ini file affect all child folders as well is referred to as making the file “recursive“. To make your public_html/php.ini file recursive, edit (or create the file if it doesn’t exist) your public_html/.htaccess file and add the following code:
(replace username with your cPanel username) This line you entered is specifying the directory where the php.ini is located that you want to make recursive. This change is immediate, so you should see the update right away.
After saving the changes, be sure to create a phpinfo page in one of your subdirectories and test the results.
Video guide on How to View your PHP Settings with a PHPinfo page
When looking at your phpinfo page, the “Loaded Configuration File” should reflect the php.ini file that you wanted to make recursive.
Now visit the site. You should not see the “Allowed memory size” error anymore. If the error still shows on your website, there may be a setting within the software itself that is overriding the change or the php.ini in the public-html may be overriden by another setting elsewhere. If this is the case, you can contact our our tech support staff to have them look into the error further.
The official WordPress guide on this topic can be found here: http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP