Posted in: WordPress Tutorials

How to fix WP error: Mismatched “post_max_size” and “upload_max_filesize” values?

Does your WordPress installation show the message in the Site Health check? If you have updated to WordPress 5.5, you might be seeing a performance suggestion for some PHP settings regarding post_max_size and upload_max_size.

Mismatched “post_max_size” and “upload_max_filesize” values.

The settings for post_max_size and upload_max_filesize are not the same, this could cause some problems when trying to upload files.

If your WordPress installation’s site health status is showing a performance recommendation about the mismatch of “post_max_size” and “upload _max_filesize”, here’s all that you should know.

  • The two terms – “post_max_size” and “upload _max_filesize” – refer to the PHP settings for your server or website.
  • Post_max_size is the maximum size of HTTP POST request (think of a form being submitted) that PHP will accept.
  • Upload _max_filesize is the maximum size of the file that you can upload to the server.
  • The two PHP settings need to follow the following order to avoid any issue: memory_limit > post_max_size > upload _max_filesize.
memory_limitThis sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.
post_max_sizeSets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size.
upload_max_filesizeThe maximum size of an uploaded file.

So, if you see the error, here’s what you should do.

  1. Log in to your hosting cPanel (or hosting dashboard)
  2. Locate the MultiPHP INI Editor icon, and click on it
  3. In the PHP INI Editor page, select the home directory or a domain’s document root to open the corresponding PHP configuration.
  4. Check for the two settings and make sure that the value for post_max_size is bigger than upload_max_filesize. If it’s not, change the value to fix it.
  5. If the upload_max_filesize value is lower than post_max_size, ignore the WordPress warning.

When to ignore the recommendation?

If the maximum size of HTTP POST request includes any file being uploaded via any form. If the “post_max_size” is less than “upload _max_filesize”, any file upload via forms be limited to the defined maximum post size.

So, the post_max_size should always be larger than the maximum filesize upload allowed.

If your PHP configuration has the post_max_size value set at a number bigger than the upload _max_filesize value, IGNORE the WordPress recommendation.

Your server’s PHP settings are correct, and WordPress is simply making a recommendation about a non-issue.