" /> How to Increase PHP Memory Limit in WordPress - Web Hosting Sure

How to Increase PHP Memory Limit in WordPress


How to Increase PHP Memory Limit in WordPress Overview

If you own a WordPress site that uses many media files, the standard storage configuration will likely not fully meet all of your needs.

How to Increase PHP Memory Limit in WordPress

You could begin to experience errors caused by PHP memory exhaustion or your site reaching its maximum upload size limit with time. There are several ways of fixing such problems, that is if you are comfortable editing your site files. (If you are not, consider contacting your web host for reconfiguration assistance). Here is a detailed guide on how to increase the PHP memory limit in WordPress.

What Will You Need?

Like all other primary changes, you should always create a new backup of your database and site files before reconfiguring your WordPress site. Doing this enables you to restore all your files if you accidentally make a mistake. Additionally, to access your site files, you will need to connect your site through SFTP, a more secure FTP. Your site files should be in the root folder but, your site host may also decide to put them at another place, so you first need to locate them.

Changing Your PHP Memory Limit

To effectively maximize your PHP Memory Limit within WordPress, there are three main options you could choose from that include:

Option 1: Edit the Wp-config.php File

The Wp-config.php contains all your base configuration details, making it one of the most vital WordPress files. To properly edit the upload limit and memory limit, you should:

  1. Check for this line: define (‘WP_MEMORY_LIMIT’, ’32M’);
  2. By increasing the second parameter, you can modify it to a PHP memory limit of about 128 M; this should get the job done.
  3. The last step is to save the file, and your work is done.

Note: If you are still receiving the ‘fatal error’ response, you may need to increase it again, but do not go overboard as this could ultimately damage your server.

Option 2: Edit the PHP.ini File

If modifying your sites’ wp-config.php file within WordPress does not solve your problem, you will need to deal with this issue within your server settings. Via the root folder, you will have access to the PHP.ini File, in which you will be able to increase the PHP upload limit by changing the following:

· file_uploads = On.

· memory_limit = 256M

· upload_ max_ size= 13M

· post_max_size = 13M

· max_execution_time = 180

It is advisable to enter the value in ascending order from lines one to three. For example, you should start with the upload_max_filesize since it is the smallest. The post_ max_ size should be the median followed by the memory_limit, which is the largest. Moreover, remember to clear your browser’s cache before checking to see if the error is erased.

Option 3: Edit the .htaccess File

In case you cannot access the PHP.ini file, then the .htaccess file is your last resort.

The .htaccess file typically begins with a dot since it is a hidden file, so if you do not see it in the root folder, check your SFTP file manager to see if it prevents you from viewing the file. To effectively increase your PHP memory, you will need to include the following to your .htaccess file:

· php_value upload_ max_ filesize 12M

· php_value memory_limit 256M

· php_value post_max_size 13M

If using the .htaccess file does not eliminate the problem, this means that your site hosting provider does not permit WordPress to maximize your PHP memory limit. Therefore, you will be required to request your web hosting service provider to allow you to increase your PHP memory limit manually.

Tip: Upgrade Your Hosting Setup

If you are using cheap shared web hosting, you are likely to find it challenging to make all the changes you need to make WordPress function the way you want. Therefore, you should upgrade your web hosting provider to at least something more proficient for such scenarios. This move will enable you to improve your sites’ performance metrics and increase your flexibility when configuring WordPress to increase your PHP memory limit.

Tip: Contact Your Webhost

Even if you are comfortable fixing your sites’ memory problem yourself, you should still consider consulting with your web service provider. This is undoubtedly important in ensuring the safety of your server. Moreover, your web host will help you make all the necessary changes in fixing your site and help you determine if the fix is essential.

Conclusion

PHP is a powerful, dynamic server-side language that can do a wide variety of things like generating HTML pages, processing WordPress queries, perform all calculations, and more. However, it needs adequate memory to perform all of these operations efficiently. So, it is essential to increase your PMP memory limit occasionally. Learning how to increase the PHP memory limit in WordPress is an excellent step toward better graphics and files on your site.

How to Increase PHP Memory Limit in WordPress

That said, remember that it is straightforward to make a mistake when reconfiguring your site’s files, so consider talking to your provider before you start.

Recent Posts