Skip to main content
All CollectionsSupplementary GuidesWordPressWP Config
PHP Memory and Max Limits in WordPress: Understanding and Adjusting Your Settings
PHP Memory and Max Limits in WordPress: Understanding and Adjusting Your Settings
Rapyd Team avatar
Written by Rapyd Team
Updated over a week ago

Running a WordPress site involves understanding certain technical aspects to keep it operating smoothly. A key factor in this is managing your PHP memory limit. Even if you're not tech-savvy, this guide will walk you through the basics of PHP memory and max limits in WordPress, why they're important, and how to adjust them.

What Are PHP Memory and Max Limits in WordPress?

In simple terms, PHP memory limit is the maximum amount of server memory that your WordPress site can use. This is vital for your website as all WordPress operations run on PHP. Having an adequate memory limit ensures these operations function effectively.

Max limits, like the maximum execution time, control how long your site can spend on individual PHP operations. It's a failsafe to ensure that one operation doesn't consume too many resources and slow down or even crash your site.

Why Are PHP Memory and Max Limits Important?

When a visitor arrives at your WordPress site, the server executes PHP scripts to display your pages. These operations need memory. If you don't have enough PHP memory allocated, your site can become slow or even crash, displaying the dreaded "white screen of death" or error messages like "Fatal error: Allowed memory size of X bytes exhausted."

The max execution time plays a similar role. If a script is taking too long to execute, it could slow down your site. This limit stops any scripts that take longer than the set time.

How to Increase PHP Memory Limit in WordPress?

Before making any changes, remember to backup your website. This helps you restore it if anything goes wrong.

To increase your PHP memory limit, you'll need to edit the wp-config.php file. Here's a step-by-step guide:

  1. Access Your WordPress Files: Go to File Manager in the Rapyd Dashboard and navigate to the public_html folder (or the folder where your WordPress files are installed).

  2. Open wp-config.php: In the list of files, find wp-config.php. Right-click on it and select Edit.

  3. Edit the File: In this file, find the line /* That's all, stop editing! Happy publishing. */ and just before this line, insert the following code: define( 'WP_MEMORY_LIMIT', '256M' ); This sets your PHP memory limit to 256M. If you want to allocate more or less memory, replace '256M' with the desired amount.

  4. Save Your Changes

After saving your changes, the new memory limit is active.

Adjusting Max Execution Time

To adjust the max execution time, you can edit the .htaccess file. Follow these steps:

  1. Access Your WordPress Files: As before, login to your Rapyd Dashboard and navigate to the File Manager and your WordPress folder.

  2. Open .htaccess: Find the .htaccess file. Right-click and select Edit.

  3. Edit the File: At the end of the file, add the following line: php_value max_execution_time 60 This sets the max execution time to 60 seconds. If you need more or less time, replace '60' with the desired number.

  4. Save Your Changes: Click on "Save Changes" or the equivalent option.

Your new max execution time is now active.

Final Words

Understanding and managing your PHP memory and max limits are crucial in running a successful and smoothly operating WordPress site. Regularly check these settings and adjust them as necessary to ensure optimal site performance.

Remember, any changes to your WordPress files carry some risk, so always back up your website before making changes.

Did this answer your question?