If you need to upload an MP3 or video to your WordPress website, sooner or later you’re going to be held hostage by the standard 10MB file upload limit.
Sure, you can always upload files via FTP, but what if you’re building a website for a client who’s eyes glaze over (and/or show a shock of alarm) when you causally mention “FTP”.
Fret not. I’m going to show you how to fix this for evermore.
The 10 MB limit comes from your php.ini file, which controls the PHP settings for your website. However, if you go into your cPanel (or alternative) account, you might well discover that this fabelled “php.ini” file is no-where to be found.
To install a default copy of php.ini that you can modify:
- Log into your cPanel account.
- Go to the Software/Services area.
- Click on the PHP Config icon.
- Once there, choose the version of PHP you will be using (read the note below first) and click Save Changes, which will place a php.ini file into your public_html directory.
- NOTE: By default, php.ini files only affect the immediate folder they are placed in (i.e. they are not recursive). To make your php.ini file recursive, use the PHP Config area to set your account to the appropriate (Single php.ini) version needed. This will ensure the php.ini file in the public_html directory is used for all the folders in your website.
- Now if you go into your public_html directory (either via FTP, or your cPanel file manager) you should see your new php.ini file happily sitting there.
- Now to upgrade the settings to allow you to have bigger uploads:
- Backup your php.ini file before you do anything.
- Then open the php.ini file so that you can edit it.
- Check that file_uploads is set to On (needed to upload files via a PHP script).
- Set upload_max_filesize to 64M (or less).
- Set post_max_size to 64M (or less).
- Set memory_limit, to 64M (or less).
- Set max_input_time to 600 or less.
- Set max_execution_time to 300 or less.
- Save your php.ini file.
You should now be good to go.
Good to know #1: upload_max_filesize, post_max_size, and memory_limit define how large the upload files can be.
Good to know #2: max_input_time and max_execution_time define how long a script can run.
Both of the above impact (either directly or indirectly) the size of the file you can upload through your WordPress admin area.
Further Exploring: there are additional descriptions within the php.ini file itself, and if you really fancy immersing yourself in the joys of the PHP, you might like http://www.php.net/docs.php