How to Increase the Maximum Upload Size in WordPress
Posted onSo you’ve decided to migrate to a self hosted WordPress blog. Congratulations! It’s an exciting step. After you’ve exported all of your posts and pages to a file using the WordPress inbuilt exporter, it’s time to upload it to your new hosting account. You go to the “Dashboard ->Tools ->Import”, select WordPress as the import option only to be suddenly informed that your import file is too large!
If you’ve been blogging for a long time, your file size could easily be greater than the tiny limits that most default WordPress implementations have. It could be 8 MB, 10 MB, or 20 MB. The actual number will vary from installation to installation. What is certain is that it will almost always be too small for any large blog. So if you don’t want to split up the file into tinier pieces, here’s how to increase the maximum upload size in WordPress so that you can upload everything in one go.
On my particular shared hosting account with Bluehost, The default maximum upload file size is 10 MB. You can see in the screenshot below that this limit is enforced in the WordPress importer itself.
Modifying PHP.INI
The file size allowed by PHP depends on the environment in which WordPress is running. In particular, it all rests on the simple php.ini file residing in the root directory of your website. Mind you, this is not the WordPress directory per se even though the two may be the same in certain installations. If your blog is in a subfolder for example, there will be no php.ini file residing in it. Search for a folder that says something like public_html instead. That is likely to be the root directory of your hosting account.
Copy this file to your desktop and also make a backup of it in case something goes wrong. This is an extremely important file and we can’t afford to mess things up. Open the downloaded php.ini in a textbased editor like Notepad++ instead of a vanilla one like Notepad. If you do the latter, you won’t be able to make out head or tail of what’s happening since it won’t render any new lines or other structure gaps.
There are two parameters that we need to change. Many tips and tutorials on the Internet will only mention one of them. This might vary from installation to installation, but here are the two that I had to modify in order to get the upload file size up to 64 MB from 10 MB.
-
upload_max_filesize
-
post_max_size
In my default php.ini, they were both set to 10M as shown below.
Replace “10” with “64” instead.
Make sure you don’t create any other modifications. Now simply upload the modified php.ini file to overwrite the existing one (once again, make sure you have a backup!)
Kill the Existing PHP Processes
Now that we have a new configuration, we have to restart the server in order to let the changes take effect. The exact way to do this will depend on your hosting environment. With Bluehost working with cPanel, i was able to go to the “processes” icon and kill the running PHP processes one by one. Don’t worry! They’ll restart automatically when necessary.
You might want to make sure that the changes have indeed taken effect using the phpinfo() command. I’ll write a tutorial later on describing exactly how to do this.
Now head over to the WordPress importer once again. As shown in the screenshot below, the new upload limit has been created.
Pretty cool huh? This little tweak should save you a lot of time and headaches and remove the need to split your huge WordPress file into several smaller ones.
Doesn’t work with fcgi