How to increase PHP limits in WordPress website

As a WordPress website grows, its PHP limits may need to be increased to accommodate its increasing needs. PHP limits refer to the maximum amount of memory, execution time, and other resources that a PHP script is allowed to consume. Here is a step-by-step guide to increasing the PHP limits in a WordPress website:

  1. Locate the .htaccess file: The .htaccess file is located in the root directory of your WordPress site. You can access it using an FTP client or the File Manager in your hosting account.
  2. Edit the .htaccess file: Once you have access to the .htaccess file, add the following code to it:
php_value memory_limit 256M
php_value max_execution_time 180
php_value post_max_size 128M
php_value upload_max_filesize 128M

The above code increases the memory limit to 256MB, the maximum execution time to 180 seconds, and the maximum file size for post and file uploads to 128MB.

  1. Save the changes: Once you have added the code to the .htaccess file, save the changes and close the file.
  2. Check the limits: You can check the new PHP limits by creating a new phpinfo.php file in the root directory of your site. The file should contain the following code:

Access the file in your browser (e.g., to see the updated PHP limits.

  1. Remove the phpinfo.php file: Once you have confirmed that the PHP limits have been increased, remove the phpinfo.php file from your server for security reasons.

By following these steps, you can easily increase the PHP limits in your WordPress website and ensure that it has the resources it needs to run smoothly and efficiently. Note that the exact steps and values may vary depending on your hosting provider and server setup. If you encounter any difficulties, you should contact your hosting provider for assistance.