Tech Stuffs

Increasing PHP Limits for WordPress

You can run into many issues on WordPress sites such as white screen of death, demo content failing to import, empty page content, etc., which are almost always related to low PHP configuration limits. That is why one of the most common requests I get from clients is to help them with increasing PHP limits.

These following directives can be set either on your .htaccess, php.ini, .user.ini, or wp-config.php file. They will work on non-WordPress sites as well, as long as they are PHP powered. If you see Error 500 or any other server-side errors, then revert the change and edit another file (php.ini instead of .htaccess, for example).

Increasing PHP Limits for WordPress

PHP Memory Limit

Maximum amount of memory in bytes that a script is allowed to allocate.

.htaccessphp_value memory_limit 256M
php.ini / .user.inimemory_limit=256M
wp-config.phpdefine('WP_MEMORY_LIMIT', '256M');

The minimum recommended limit is 128M.

PHP Max Execution Time

Amount of time in seconds that your site will spend on a single operation before timing out to avoid server lockups.

.htaccessphp_value max_execution_time 300
php.ini / .user.inimax_execution_time=300
wp-config.php@ini_set( 'max_execution_time' , '300' );

The minimum recommended size is 180.

PHP Max Input Time

Maximum time in seconds a script is allowed to parse input data, like POST and GET. Default setting is -1, which means that max_execution_time is used instead. Set to 0 to allow unlimited time.

.htaccessphp_value max_input_time 300
php.ini / .user.inimax_input_time=300
wp-config.php@ini_set( 'max_input_time' , '300' );

The minimum recommended size is 60.

PHP Max Upload Size

Largest file size that can be uploaded to your WordPress installation.

.htaccessphp_value upload_max_filesize 1024M
php.ini / .user.iniupload_max_filesize=1024M
wp-config.php@ini_set( 'upload_max_size' , '1024M' );

The minimum recommended size is 32M.

PHP Max Post Size

Maximum size for all POST body data.

.htaccessphp_value post_max_size 1024M
php.ini / .user.inipost_max_size=1024M
wp-config.php@ini_set( 'post_max_size' , '1024M' );

The minimum recommended size is 32M.

PHP Max Input Vars

Maximum number of variables your server can use for a single function to avoid overloads.

.htaccessphp_value max_input_vars 5000
php.ini / .user.inimax_input_vars=5000
wp-config.php@ini_set( 'max_input_vars' , 5000 );

The minimum recommended limit is 3000.

If you don’t feel comfortable in trying the above methods, or if they didn’t work for you, then you need to contact your hosting company support.

Leave a Comment