post_max_size being defined as smaller than upload_max_filesize in php.ini

Posted May 18, 2017 15.8k views
ApachePHPWordPressPHP FrameworksUbuntu 16.04

Hi guys!

On my Wordpress site I have this message:

File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.

On my php.ini file I have the following:

upload_max_filesize: 64M
post_max_size: 90M
memory_limit = 128M

Someone can you help me?

Thanks in advance

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer


There’s a few potential scenarios.


If you’ve not already, check the permissions on your files and directories. Unless you’ve changed the user that Apache runs as, files and directories should be owned by the www-data user.

From the CLI, you can run ls -al on your home directory (where index.php is) to see the user and the group that currently owns your files and directories.

If root or another user owns anything there, you’ll most likely need to use chown to change that.

For example, if your home directory is /var/www/html (and ./html is where index.php is), we can run:

chown -R www-data:www-data /var/www/html

That sets all files and directories to be owned by www-data.


In some cases, some plugins simply don’t work as expected. If the above doesn’t work, disable all your plugins and try to upload a file. If it succeeds, re-enable plugins one-by-one until you’re not able to upload again. That’ll help identify which plugin is causing the issue.

Check the Logs

tail -20 /var/logs/apache2/error.log

The above command will dump the last 20 lines of the Apache error log to the CLI. If there’s a script error or something else going on during the attempt, it should get logged there and by looking over the errors, you may be able to identify something that isn’t immediately available when disabling and enabling plugins.

Restart Apache

If you made changes to php.ini but didn’t restart Apache, the settings aren’t valid. Only once you restart Apache will those changes take effect.

service apache2 restart
Submit an Answer