Friday, October 16, 2009

PHP Upload Limit

Sometimes, you write a code which has upload features or backing up a database then only to find out that your PHP installation limits your upload to 2mb. Ive encountered this problem while I was backing up databases using phpMyAdmin and realized that the file ive downloaded is too huge for an upload without tweaking the necessary files. So with this I resulted to editing the php.ini file to accommodate a larger file upload size.

The php.ini file varies from one location to another depending on your install (may it be Windows, Mac or Linux).. In my Linux server (Ubuntu) its found in /etc/php5/apache2/

Here are the variables you need to watch

file_uploads
upload_max_filesize
max_input_time
memory_limit
max_execution_time
post_max_size

You may change the values as you like but take note that setting some things higher (ie. memory_limit) would consume your resources a bit more. So be careful in editing.

After tampering the settings, you may need to restart your Apache service before this takes effect.

No comments:

Post a Comment