Solving WordPress Out of Memory Problems: Four Ways to Increase PHP Memory Limits

Understanding PHP Memory Limits in WordPress

图片[1]-解决 WordPress 内存不足问题:增加 PHP 内存限制的四种方法-光子波动网 | WordPress教程、Elementor教程与故障修复

If you encounter a "Fatal error: Allowed XXXX bytes memory size exhausted" error while editing your WordPress site, it may be due to insufficient PHP memory limit.

What is PHP Memory Limit?

The PHP memory limit is the maximum amount of memory that can be used by a PHP script on a server.WordPress requires a certain amount of memory to run, and exceeding this limit will result in errors and crashes.

图片[2]-解决 WordPress 内存不足问题:增加 PHP 内存限制的四种方法-光子波动网 | WordPress教程、Elementor教程与故障修复

How can I detect memory limit problems?

This can be accessed from the WordPress dashboard via the " " tool to detect if you are experiencing memory limitation problems. This tool will help you identify problems with your website and provide suggestions for fixing them.

图片[3]-解决 WordPress 内存不足问题:增加 PHP 内存限制的四种方法-光子波动网 | WordPress教程、Elementor教程与故障修复

How do I increase the PHP memory limit for WordPress?

Here are four easy ways to increase the PHP memory limit for WordPress:

Method 1: via wp-config.php file

  1. Open the wp-config.php file in the root directory of your WordPress installation.
  2. Add the following code:
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '256M');
  1. Save the file. This sets the memory limit to 256MB.

Method 2: Via .htaccess file

  1. Connect to your site using an FTP client and locate the .htaccess file in the root directory.
图片[4]-解决 WordPress 内存不足问题:增加 PHP 内存限制的四种方法-光子波动网 | WordPress教程、Elementor教程与故障修复
  1. Add the following code to the file:php_value memory_limit 256M
  2. Save the file and upload it. This sets the memory limit to 256MB.

Method 3: via php.ini file

  1. Find the location of your php.ini file, which can be found with the following code:
  1. Open the php.ini file and find the memory_limit Set and modify it to:
memory_limit = 256M
  1. Save the file and upload it.
图片[5]-解决 WordPress 内存不足问题:增加 PHP 内存限制的四种方法-光子波动网 | WordPress教程、Elementor教程与故障修复

Method 4: Setup via Server and Hosting Panel

  1. If using cPanel, navigate to "hardware" section and use the MultiPHP INI editor.
  2. Select the domain to be modified and adjust the memory limit value.
图片[6]-解决 WordPress 内存不足问题:增加 PHP 内存限制的四种方法-光子波动网 | WordPress教程、Elementor教程与故障修复

If you are unable to make the change yourself, you can contact your hosting provider for assistance.

Verify that the PHP memory limit has been increased

  1. log in WordPress DashboardGo to "artifact"➡️"Site Health"Part.
  2. Click "text" tab, scroll to "server (computer)" section to find the PHP memory limit settings.
  3. If the value increases to the amount you set, the change has taken effect.
图片[7]-解决 WordPress 内存不足问题:增加 PHP 内存限制的四种方法-光子波动网 | WordPress教程、Elementor教程与故障修复

Summary:

When using a WordPress website with a PHP memory limit issue, it is usually the maximum amount of memory used by PHP scripts on the server that exceeds the limit causing the website to crash. This can be done by editing the wp-config.php Documentation,.htaccess Documentation,php.ini file, or increasing the memory limit through the server hosting panel, can effectively solve this problem.

图片[8]-解决 WordPress 内存不足问题:增加 PHP 内存限制的四种方法-光子波动网 | WordPress教程、Elementor教程与故障修复

Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
Customer Service
Customer Service
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: [email protected]
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
本文作者:红牛独立站
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments