The PHP Memory Limit In WordPress, the memory limit determines the maximum amount of memory a PHP script can use. A limit that's too low can lead to errors and impair your website's functionality. In this guide, we'll show you how to increase the PHP memory limit to optimize the performance of your WordPress website.
Why is the PHP memory limit important?
Because WordPress and its plugins are PHP-based, a sufficient PHP memory limit is crucial for smooth operation. A limit that's too low can lead to the following problems:
- White screen of death: Your website only displays a blank screen.
- Error uploading media: Images or files cannot be uploaded.
- Plugin malfunctions: Some plugins, especially large ones like WooCommerce, do not work correctly.
- Error messages: Messages like “Allowed memory size exhausted” appear.
How do you check your current PHP memory limit?
You can see the current limit directly in WordPress:
- Register: Log in to your WordPress dashboard.
- Navigate: Go to Tools > Website Health.
- Open report: Switch to tab report.
- Server information: Click on serverto see details like the PHP memory limit.
This is what the whole thing looks like:

Methods to increase the PHP memory limit
There are several ways to increase the limit. Here are the most common methods, where we will adjust the limit via the wp-config.php
recommend.
1. Adjustment of the wp-config.php
(Recommended)
The wp-config.php
is a central configuration file of your WordPress installation.
Steps:
- FTP access: Connect to your server via FTP.
- Find file: Navigate to the root directory of your WordPress installation and open the
wp-config.php
. - Insert code: Add before the line
/* That's all, stop editing! Happy blogging. */
Enter the following code:phpCopy codedefine('WP_MEMORY_LIMIT', '256M');
- Save: Save the file and upload it back to the server.
2. Adjustment of the .htaccess
The .htaccess
is a configuration file for Apache web servers and can override PHP settings.
Danger: Modifications to this file may render the website inaccessible. Please exercise caution.
Steps:
- Show hidden files: Make sure your FTP program shows hidden files.
- Edit file: Open the
.htaccess
in the main directory. - Add code: Add the following code to the end of the file:Copy code
php_value memory_limit 256M
- Save: Save the changes.
3. Adjustment of the php.ini
The php.ini
controls the PHP configuration at the server level.
Notice: Not all hosts allow access to this file.
Steps:
- Locate file: Search for the
php.ini
in the main directory or create it if it doesn't exist. - Insert code: Add the following code:makefileCopy code
memory_limit = 256M
- Save: Save the file and upload it.
4. Use of BlitzWP services
If you use BlitzWP, you benefit from first-class support that takes care of such technical adjustments for you.
- Contact support: Contact our support team and ask to increase the PHP memory limit.
- Conclude a maintenance contract: Leave the regular maintenance of your website to us and we will take care of all the technical details.
What to do if nothing works?
If none of the above methods work, the limit may be set on the server side.
- Contact hoster: Contact your hosting provider and ask them to increase the PHP memory limit.
- Change hosting: If your host doesn't offer higher limits, we recommend switching to a more powerful provider like BlitzWP.
Conclusion
A sufficient PHP memory limit is essential for the performance and stability of your WordPress website. You can increase the limit yourself using the methods mentioned above, or you can get help from BlitzWP.
Notice: Always create a backup copy of any changes to important files!
BlitzWP We provide you with professional support and customized solutions. Please contact us for further assistance.