This was a minor odyssey – I’m trying to import a Wordpress Export/XML file to this blog, yet the file size of 2.8MB exceeds the built-in limit of 2MB. Apparently this was included as a bandwidth hedge for hosters of some kind.

Judging by the amount of Google hits on “upload_max_filesize wordpress” it’s apparent this isn’t a simple fix.

In any case, the answers start with “Change your php.ini file” followed with “if that doesn’t work, change your .htaccess file”. The latter is often suggested as some hosters don’t allow you to edit php.ini. Mine (BlueHost) does, as confirmed via a quick live support chat tonight.

So great, I can edit php.ini – and I need to change this line:

upload_max_filesize = 2M

to

upload_max_filesize = 10M

or whatever your desired max upload file size is. “M” = Megs. You also need to add, right below the above, on its own line:

post_max_size = 20M

Again, edit the # to whatever you need, though it apparently needs to be larger than the upload_max_filesize #.

But I have several php.ini files, and none seem to make the change work!

Ah, so the clincher in a Wordpress install, for me at least – WHICH php.ini file needs to be edited? You may have several -> at your www root, inside your WP install, etc. In my quest, it turns out NONE worked – but the help text from my hoster included in the php.ini file (any of them – all were the same) noted that I needed to copy over a php.ini file into whatever folder held my upload script, aka “upload.php”.

In Wordpress, that means wp-admin folder. So the solution, in short:

  1. Confirm you can in fact access/edit your php.ini files. Assuming yes (if no, go see this article referencing the .htaccess bit), then
  2. Copy/duplicate the php.ini file that sits in your Wordpress install’s root folder.
  3. Move the copy to wp-admin
  4. Rename it back to php.ini
  5. Add in the above code
  6. Save

No guarantees whatsoever, but it worked for me! If you are all all nervous about playing with some of your core Wordpress or hoster files, I’d probably hop over to your hoster’s support forums first.

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • StumbleUpon
  • Tumblr
  • Twitter