WordPress

Important settings for PHP and WordPress — The Guide

2 min readUpdated September 11, 2022
WordPress and PHP server settings guide

Three PHP settings every WordPress site owner needs to know: max_execution_time, memory_limit, and upload_max_filesize. Here's how to check and configure them.

Proper PHP configuration is essential for a stable and performant WordPress installation. Three settings in particular have the greatest impact on day-to-day operation: max_execution_time, memory_limit, and upload_max_filesize.

Common Error Messages

If you see a message like "The uploaded file exceeds the upload_max_filesize directive in php.ini", your server's PHP settings need to be adjusted.

PHP Version Requirements

  • Recommended: PHP 8.x (best performance)
  • Minimum acceptable: PHP 7.4 (security support ended November 28, 2022)
  • PHP 8.0 security support through November 26, 2023

PHP 8 offers significantly better performance than version 7. Outdated plugins or themes may initially resist upgrades — replace them rather than staying on an old PHP version.

How to Check Your Current PHP Configuration

Upload a file named phpinfo.php to your root directory with the following content, then open it in your browser:

<?php phpinfo(); ?>

This outputs your entire PHP configuration. Look for the relevant directives in the output.

Critical PHP Settings to Monitor

  • max_execution_time — maximum script run time in seconds
  • max_input_time — maximum time allowed to parse input data
  • memory_limit — maximum memory a script can use
  • post_max_size — maximum size of POST data
  • upload_max_filesize — maximum size for file uploads

Minimum Recommended Configuration

max_execution_time = 300
max_input_time = 1000
memory_limit = 256M
post_max_size = 128M
upload_max_filesize = 128M

This allows PHP scripts to use 256 MB of memory with a 5-minute execution time. Upload limits are set at 128 MB.

Generous Configuration (for memory-intensive plugins)

For plugins like Wordfence that require more resources:

max_execution_time = 500
max_input_time = 3000
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 128M

Your hosting provider may limit maximum allocation — contact their support if the settings don't take effect.

Where to Apply These Settings

Settings belong in your php.ini file. If you don't have access to php.ini, you can add them to your .htaccess file instead. The .htaccess file (dot-prefixed, hidden by default) applies to its directory and all subdirectories. Your SFTP client may need to be configured to show hidden files.

Verify Your Changes

After adjusting settings, revisit phpinfo.php in your browser to confirm the new values are active. Remember to delete the phpinfo.php file afterwards for security reasons.