PHP Fatal Error Maximum Execution Time Issue & htaccess

php-upload-big-files-htaccessLot of times it happen that we get some weird error in PHP. One of such errors is a Fatal Error that usually occurs when Uploading big files in PHP.

This error has to do something with the Maximum timeout setting. When we upload a large file it may happen that the timeout occurs and result in failure. This is commonly seen while upgrading plugins in WordPress.

So how to avoid these errors? Well, htaccess comes to rescue in such problems.
Related: 21 Very Useful htaccess Tips & Tricks

The default value of file upload size for most of the webservers is 2MB. This limit a user from uploading large files to the server. Add following lines in your .htaccess file to change the default size for upload. If .htaccess file is not present in your root directory, create one.

#Set the Maximum Input time
php_value max_input_time 200

#Maximum size allowed in Post method
php_value post_max_size 20M

#Set the Maximum Execution Time for Script
php_value max_execution_time 200

#Set the Maximum Upload Filesize
php_value upload_max_filesize 15M
Get our Articles via Email. Enter your email address.

You may also like...

1 Comment

  1. Uboonto says:

    Nice post, I wasn’t aware of htaccess method. There are other methods to change php time limit: http://www.sudo-juice.com/php-time-limit-extend-script-running-time/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.