Increase execution time,memory limit,file upload size,session using htaccess

02nd, January 2018 By

You can change the execution time of php script,memory limit ,maximum file upload size and session life time from the .htaccess file.Just copy and paste this code in your htaccess  file.

<IfModule mod_php5.c>
php_value max_execution_time 200
php_value memory_limit 20M
php_value post_max_size 20M
php_value upload_max_filesize 4M
php_value session.gc_maxlifetime 900
php_value max_input_time 500
</IfModule>

php_value name value

name value = your variable which you want to set like max_execution_time

php_value max_execution_time

The max_execution_time function sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.The default time is 30 second.

php_value max_execution_time 200

Where max_execution_time is set for 200 seconds.

php_value memory_limit

This function sets the maximum amount of memory in bytes that a script is allowed to allocate.This will help badly written script to use extra memory.

php_value memory_limit 20M

Where memory limit is set for 20Mb.

php_value post_max_size

Sets max size of post data allowed. This setting also affects file upload ,for upload large files this value must be larger than the upload_max_filesize.

php_value post_max_size 20M

Where post data allowed upto 20 MB.

php_value upload_max_filesize

This function will increase the upload limit of file to the server.The default value for this function is 2 mb.You will set it what ever you want for your website.

php_value upload_max_filesize 4M

Where upload file limit increase to 4MB.

php_value session.gc_maxlifetime

This function specifies the number of seconds after which data will be seen as ‘garbage’ and potentially cleaned up.

php_value session.gc_maxlifetime 900

Where session.gc_maxlifetime is set for 900 seconds.

php_value max_input_time

This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. It is measured from the moment of receiving all data on the server to the start of script execution.

php_value max_input_time 500

Where maximum input parse time is set for 500 seconds.

Leave a Reply

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