Set PHP Limits with .htaccess
A quick summary of some of the PHP limits that can be set via the .htaccess file.
Set PHP memory limit
To set a custom limit for the amount of memory that can be used by PHP, add the following to your site’s .htaccess file:
php_value memory_limit 64M
Note: specify units in megabytes and include the M
.
Set PHP execution time
To set a custom limit for the amount of execution time allowed for any PHP script, add the following directive via .htaccess:
php_value max_execution_time 500
Note: specify units in seconds (do not include any unit identifier such as s
).
Set PHP input time
To set a custom limit for the amount of time that PHP is allowed to process input data (such as POST and GET), add the following .htaccess directive:
php_value max_input_time 500
Note: specify units in seconds (do not include any unit identifier such as s
).
Set PHP POST size
To set a custom limit for the maximum size allowed for POST data, add the following .htaccess directive:
php_value post_max_size 4M
Note: specify units in megabytes and include the M
.
Set PHP file upload size
To set a custom limit for the maximum size allowed for uploaded files, add the following .htaccess directive:
php_value upload_max_filesize 10M
Note: specify units in megabytes and include the M
.
See also: Limit HTTP Request Size