Omar Alves
Omar Alves

Reputation: 763

For a PHP application, how do I set different timeouts for certain URLs in Apache HTTP server?

Is it possible to set up a different timeout for specific URLs. For instance, I would like that http://myserver.com/save_message have a timeout of 2 seconds, differently than my server default.

This URL calls a PHP script. Is the PHP script terminated automatically when the timeout happens?

Upvotes: 1

Views: 1842

Answers (1)

Atul Pandya
Atul Pandya

Reputation: 333

You can set timeout by below list different ways:

(1) In PHP script file (for example, settings.php)

For example you can place this values in common settings file which is being included in all files

ini_set('max_execution_time', 300); //300 seconds = 5 minutes

(2) .htaccess file settings

php_value max_execution_time 300

(3) Apache virtual host configuration file settings:

As well if you have access server access than you can set in apache configuration file. If you do changes in server configuration file than you need to restart apache service.

i.e php_value post_max_size 5M php_value upload_max_filesize 5M php_value memory_limit 128M php_value max_execution_time 300 php_value max_input_time 300 php_value session.gc_maxlifetime 1200

I hope these would be helpful for you.

Upvotes: 1

Related Questions