Best PHP ini Settings for WordPress & WooCommerce: Official Recommendations

Best PHP ini Settings for WordPress & WooCommerce: Official Recommendations

When it comes to running a WordPress website, especially if it includes WooCommerce for e-commerce functionality, configuring your PHP settings is crucial. Proper PHP settings can improve your site’s performance and ensure that it can handle the demands of your content and e-commerce operations.

In this guide, we’ll explore the recommended PHP.ini settings for WordPress and WooCommerce, and we’ll show you how to make these changes on various server environments.

Also check [Fix] File Permission Issue in Apache Website WordPress Not Writeable to 775

Best PHP ini Settings for WordPress & WooCommerce: Official Recommendations

Recommended PHP Settings for WordPress and WooCommerce

  1. Upload Max Filesize: It’s essential to adjust the maximum file upload size to accommodate larger media files. A common value is 32MB, but for WooCommerce, which often handles larger product images, you can set it to 48MB.
   upload_max_filesize = 48M
  1. Post Max Size: The “post_max_size” setting should be at least as large as the “upload_max_filesize” to ensure compatibility. Set it to the same value as “upload_max_filesize.”
   post_max_size = 48M
  1. Memory Limit: Increasing the memory limit ensures that WordPress and its plugins have sufficient memory to operate efficiently. A recommended value is 256MB.
   memory_limit = 256M
  1. Max Execution Time: A longer maximum execution time prevents timeouts during complex operations. For WooCommerce, set it to 600 seconds.
   max_execution_time = 600
  1. Max Input Vars: A higher value for this setting prevents issues with large forms or complex themes and plugins. Set it to 1000.
   max_input_vars = 1000
  1. Max Input Time: Increase the maximum input time to 400 seconds, especially if you have large data submissions or complex forms.
   max_input_time = 400

Now, let’s see how you can edit the php.ini file on different types of servers to make these changes.

How to Edit php.ini on Different Server Types

1. cPanel:

  • Log in to your cPanel account.
  • Navigate to “Select PHP Version” or “MultiPHP Manager” under “Software.”
  • Choose the desired PHP version.
  • Click “Switch to PHP Options” or “PHP Settings.”
  • Modify the values for the settings mentioned above.
  • Save your changes.

2. Plesk:

  • Log in to your Plesk control panel.
  • Go to the “Websites & Domains” section.
  • Select your website.
  • Click “PHP Settings” or “PHP Options.”
  • Adjust the PHP settings and save.

3. Shared Hosting (No Control Panel):

If you’re on shared hosting without a control panel, you might not have direct access to your php.ini file. Contact your hosting provider’s support team and request them to make the necessary changes for you. They should be able to accommodate your request.

4. Dedicated/VPS Servers:

If you have your dedicated server or VPS, follow these steps:

  • SSH into your server.
  • Locate your php.ini file. It’s often found in /etc/php/7.x/cli/ or /etc/php/7.x/apache2/, where “7.x” is the PHP version you’re using.
  • Use a text editor (e.g., nano or vim) to edit the php.ini file.
  • Make the changes to the recommended settings.
  • Save the file.
  • Restart Apache or PHP-FPM to apply the changes.

Conclusion

Configuring the right PHP settings for your WordPress and WooCommerce site is vital for optimal performance. By adjusting the php.ini file to match the recommended settings, you’ll be able to handle larger media uploads, complex forms, and e-commerce operations more efficiently.

Remember to create a backup of your php.ini file before making any changes, and always consult your hosting provider or server administrator if you’re uncertain about the process. With the right PHP settings in place, your WordPress and WooCommerce site will run smoothly and handle your web traffic and e-commerce transactions effectively.

Sandy

Sandy

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *
Email *