Support » Fixing WordPress » Mismatched “post_max_size” and “upload_max_filesize” values.

  • Hello. WordPress site health status is suddenly showing this recommended improvement:

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

    I don’t even know where the settings for both are, so I have no idea how to make them the same. I’m hoping somebody here can help. Thank you.

Viewing 15 replies - 1 through 15 (of 54 total)
  • These are settings on your web server (not in WordPress), controlling the amount of memory available to PHP for uploading files (hence the max size of uploaded files).

    If you run your own server, you have full control over these values. But if you’re in a shared hosting environment, your host may or may not give you control over this at all.

    Now I’m a sysadmin and not a developer, and I don’t know the reason why the WordPress developers have this recommendation.

    From the official PHP documentation:

    upload_max_filesize is the maximum size of an uploaded file. This is the limit for a SINGLE file.

    post_max_size, on the other hand, is the limit of the entire body of the request (which may include multiple files as well as other stuff). The PHP documentation even says “To upload large files, this value must be larger than upload_max_filesize.

    Now I don’t know which of your two values is greater, but from the official descriptions of these two properties, the better recommendation should really be that post_max_size should always be equal to OR greater than upload_max_filesize

    Dion

    (@diondesigns)

    The PHP documentation states that post_max_size should be larger than upload_max_filesize. I have no idea why Site Health would generate such a message.

    https://www.php.net/manual/en/ini.core.php#ini.post-max-size

    One hopes, though, that Site Health is verifying that memory_limit is larger than post_max_size. Serious problems can occur, including loss of data, if it is not.

    Thread Starter gorgeouskitty

    (@gorgeouskitty)

    @gappiah @diondesigns

    Thank you for replying. So what do I do now? :-O

    I have a shared hosting plan, by the way.

    • This reply was modified 11 months, 3 weeks ago by gorgeouskitty.

    @gorgeouskitty @diondesigns @gappiah
    I’m having this exact same issues using bluehost/wordpress.

    insert this 2 line in end of .htaccess file:

    php_value upload_max_filesize 100M
    php_value post_max_size 100M

    @samadha that creates an internal server error and everything is unreachable.

    In my case I had the following mismatch in my php.ini file on the server:

    memory_limit = 256M
    post_max_size = 260M
    upload_max_filesize = 256M

    I changed post_max_size to post_max_size = 256M in that file and the warning is no longer being displayed in WordPress

    Thread Starter gorgeouskitty

    (@gorgeouskitty)

    @robhowells I logged into cpanel and searched for php.ini, but no results came up. I wonder why this problem suddenly popped up now. I haven’t made any recent changes to settings of any sort. I did update WordPress to the latest version right before I thought to check site health settings.

    @gorgeouskitty you should be able to locate the php.ini file within the ‘File manager’ within cpanel. Alternatively, depending on your host you may have something under ‘Software’ in cpanel that allows you to edit that file. I have something called ‘MultiPHP INI Editor’, for example.

    Failing that, your host provider should be able to update it for you.

    @gorgeouskitty the reason for the message suddenly appearing is because a new Site Health check was added as part of WordPress 5.5, to give a warning when there is a mismatch in allowed values

    Thread Starter gorgeouskitty

    (@gorgeouskitty)

    @robhowells Thank you! I found it in Software > MultiPHP INI Editor. It wasn’t in File Manager > public_html like in the article I googled.

    I followed what you did and changed post_max_size to 256M to match memory_limit and upload_max_filesize. The warning disappeared from site health status. Thanks again. πŸ™‚

    Thread Starter gorgeouskitty

    (@gorgeouskitty)

    @solanabarton Have you resolved the issue on your end? I was going to mark this problem as resolved, but maybe you might need more help. πŸ™‚

    Dion

    (@diondesigns)

    It is not an issue! It is a bug in Site Health.

    You should ignore the message until the bug is fixed. And please don’t mess around with your PHP settings to try to “fix” this…you will likely create problems where there were none.

    @diondesigns oh right, I see. But if the post_max_size is greater than the memory_limit could that not cause issues? Doesn’t it make more sense to have a max post size that is less than or equal to the memory limit?

    Dion

    (@diondesigns)

    But if the post_max_size is greater than the memory_limit could that not cause issues? Doesn’t it make more sense to have a max post size that is less than or equal to the memory limit?

    Yes, which is what I said in my first post in this topic. πŸ™‚

Viewing 15 replies - 1 through 15 (of 54 total)
  • The topic ‘Mismatched “post_max_size” and “upload_max_filesize” values.’ is closed to new replies.