What is php memory limit and how to increase it in WordPress

PHP memory limit is the maximum amount of memory that a PHP script can use during its execution. When a PHP script reaches its memory limit, it can cause errors such as “Fatal error: Allowed memory size of X bytes exhausted”.

In WordPress, the default PHP memory limit is usually set to 64MB. However, some plugins and themes may require more memory to function properly, and you may need to increase the PHP memory limit.

To increase the PHP memory limit in WordPress, you can do one of the following:

  1. Edit the wp-config.php file You can increase the PHP memory limit by adding the following line to your wp-config.php file:
define( 'WP_MEMORY_LIMIT', '256M' );

This will set the PHP memory limit to 256MB. You can change the value to any amount that you need.

  1. Edit the .htaccess file If you have access to your .htaccess file, you can add the following line to increase the PHP memory limit:
php_value memory_limit 256M

This will set the PHP memory limit to 256MB. Again, you can change the value to any amount that you need.

  1. Edit the php.ini file If you have access to the php.ini file, you can increase the PHP memory limit by changing the following line:
memory_limit = 64M

You can change the value to any amount that you need.

It’s important to note that not all web hosts allow you to increase the PHP memory limit. If you’re not sure whether your web host allows it, you should contact them for assistance.

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

Testimonials
Subscribe weekly news

Integer posuere erat a ante venenatis dapibus posuere velit aliquet sites ulla vitae elit libero 

Login