PHP as a CGI script with suexec

For hosts running PHP as a CGI script with suexec you may be able to put these directives in a php.ini file in your website root directory.

upload_max_filesize = 10M
post_max_size = 20M

Add the below to your .htaccess file in your web root directory.

php_value upload_max_filesize 10M
php_value post_max_size 20M

The PHP documentation states that the memory_limit setting also affects file uploading.
Generally speaking, memory_limit should be larger than post_max_size.

Depending on your host, this can be done in a number of places with the most likely being php.ini or .htaccess depending on your hosting situation.

Add for example:

memory_limit = 16M to your php.ini file (recommended, if you have access)

With root access, you can use the sed util in Linux/Unix based systems, in order to increace the memory for 64M. Don’t forget to properly locate you php.ini file!

sed -i ’s/memory_limit = 16M/memory_limit = 64M/’ /etc/php5/apache2/php.ini

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.