Increasing the PHP memory limit in WordPress is a very common question everybody is asking. Here, we’ll present you with the best guide on how you can increase the PHP memory limit without any hassle.
WordPress PHP memory limit error is a message that appears when WordPress tries to execute the PHP statement that causes the error. The most common cause is not setting up enough memory to execute the PHP.
To check this, open the hosting account settings page, and see the memory limit for your account. If it’s not enough, contact your hosting provider for help. You can also increase the PHP memory limit on your own. Here is the short user guide to increasing the WordPress PHP memory limit for your website.
To increase the PHP memory limit in WordPress follow the steps below:
1: Edit the wp-config.php file
Once you open the wp-config.php file, please find the below code and paste the following line just before the line where it says “/* That’s all, stop editing! Happy publishing. */”
define( 'WP_MEMORY_LIMIT', '512M' );
This code will increase the PHP memory limit to 512 MB. Now, you’ll need to save the changes you’ve made and upload the wp-config.php file to its correct location. You can set your own limit. Here we set it to 512MB as an example. You can also change it to 128MB or 256MB or any other valid input value.
2: Restart the server
You need to restart the server to apply the changes. It will take some time for the changes to be applied. If you have already installed WordPress, then you need to download the latest version of WordPress and then install it again.
3: Increase PHP memory limit in.ini file
You can also increase the PHP memory limit in the php.ini file. There is a section called memory_limit which is used to set the memory limit for PHP.
If you want to increase the memory limit from 128M to 256M, then you need to change the following line.
memory_limit = 256M
You've successfully updated your PHP memory limit for your WordPress website. Now you can check your website settings and you won’t see the memory limit warning anymore.
If you have any issues, please leave a comment below.
If you are looking for the answer to other how-to questions, please visit our website for more how-to-related content.