how to enable larger file uploads in MediaWiki

From Sharkysoft Wiki
Jump to: navigation, search

While trying to upload a media file to my MediaWiki wiki, I ran across the following error message:

The file you uploaded seems to be empty.

This error message was misleading, and it led me on a wild goose chase for quite some time.

Eventually, I discovered that the problem was caused by overly conservative PHP settings, which were limiting the maximum uploaded file size that the PHP environment would allow.  On a typical Ubuntu installation of Apache and PHP, the maximum PHP upload size is limited to 2M.

Fortunately, this problem is easy to fix.  Simply add the following directives to your Apache configuration file:

php_value upload_max_filesize "4M"
php_value post_max_size "4M"

You can add these directives either to your virtual host file in /etc/apache2/sites-available or to /etc/apache2/apache2.conf.

Then restart your server:

sudo service apache2 restart

And that's it! The settings shown above should double the default maximum allowed file size. If you need to upload even larger files, you can set the values even higher.

Personal tools
Namespaces

Variants
Actions
Navigation
Tools