Apache

How To Set PHP Maximum Execution Time In An .htaccess File

In this article I will describe how to set the maximum execution time for PHP scripts by using the max_execution_time directive in an .htaccess file.

I assume that you have already set up a custom .htaccess file. Please setup a custom .htaccess file if you have not setup it.

Setup Max Execution Time For PHP Scripts

By default, maximum execution time for PHP scripts is set to 30 seconds. If PHP scripts runs longer than 30 seconds, PHP stops the script and report an error. You can change max execution time using the max_execution_time directive in an .htaccess file.

Follow the below steps to change the maximum execution time for PHP scripts:

1. login to your server using SSH.

2. Open the .htaccess file in any text editor to add the following line. Replace 30 with the maximum execution time value that you want to set.

# vim .htaccess
.....
php_value max_execution_time 30
..

3. Save and close the .htaccess file.

4. Verify that new setting is active or not, you will need to create a PHP test file that the contains the following code in the same directory where .htaccess file is located.

# vim phpinfo.php
<?php phpinfo(); ?>

Save and close.

5. Load the test file in your web browser, and then search for the name of the directive. The Local Value column should display the new setting that you specified in the .htaccess file.

http://domain_name_or_IP_add/phpinfo.php

php-maximum-execution-time

Thanks:)

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment