Change and Increase the Max PHP File Uploading Limit

The default php configuration comes with a hard cap of 2MB on the size of uploaded file determined by the php.ini directive upload_max_filesize in conjunction with post_max_size. The maximum uploading size of a file is the lower. Therefore, to increase the uploading cap and raise uploading limit, you will need to edit those 2 directives in php.ini.

The location of php.ini varies distribution by distribution, in this example, with Ubuntu 9.04 Jaunty, php.ini is located at /etc/php5/apache2/php.ini, so

sudo vi /etc/php5/apache2/php.ini

Press / to find upload_max_filesize and change it to, say 8M:

upload_max_filesize = 8M

Press ESC, :, wq and Enter. Now the php.ini is saved with the new uploading file limit. Reload apache2 to read the new configurations:

sudo /etc/init.d/apache2 reload

Now you should be able to upload any file up to 8MB in size, in case you need larger uploading limit, in addition to change upload_max_filesize to, say, 16M, you must also edit post_max_size to more than or equaling to 16M because file uploads are processed through HTTP POST method.