By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,247 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,247 IT Pros & Developers. It's quick & easy.

max-execution-time HTTP timeout ?

P: n/a
Hi NG,

I have my own apache server 2.0.54 running with php 4.3.10.

I got a little logical problem here about http requests.

I have written a small php script which waits for x seconds. Every
second it appends the seconds to a file.

I expected a timeout after 300 seconds, becouse apache is configured
like that. But until now it doesn't matter. I can wait for more than 5
minutes and the script finishes i see the result page.

Why my browser doesn't get a timeout. Which part is responsible for a
timeout???

One said that it is configurable over the directive max-execution-time
in php.ini. BUT this one is set to 30 seconds. The timeout directive in
httpd.conf is 300 seconds.

One apache group user said, that maybe the max-execution-time of
php.ini maybe only applies to CPU time (non-sleeping).

How I can prevent scripts of running endless??? Which parts are
responsible?

Here the code:

<?php

// All print functions do not show up on the screen until it is
finished
print 'Now we wait<br>';

for($i = 1; $i <= 360; ++$i) {
sleep(1);
print "$i<br>";
$handle = fopen('test.dat', "a");
fwrite($handle, $i . "\n");
fclose($handle);
}

print '<br><br>End...<br>';

?>

Thanks...

Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 18.11.2005 11:37, hakim wrote:
Hi NG,

I have my own apache server 2.0.54 running with php 4.3.10.

I got a little logical problem here about http requests.

I have written a small php script which waits for x seconds. Every
second it appends the seconds to a file.

I expected a timeout after 300 seconds, becouse apache is configured
like that. But until now it doesn't matter. I can wait for more than 5
minutes and the script finishes i see the result page.

Why my browser doesn't get a timeout. Which part is responsible for a
timeout???

One said that it is configurable over the directive max-execution-time
in php.ini. BUT this one is set to 30 seconds. The timeout directive in
httpd.conf is 300 seconds.

One apache group user said, that maybe the max-execution-time of
php.ini maybe only applies to CPU time (non-sleeping).

How I can prevent scripts of running endless??? Which parts are
responsible?

Here the code:

<?php

// All print functions do not show up on the screen until it is
finished
print 'Now we wait<br>';

for($i = 1; $i <= 360; ++$i) {
sleep(1);
print "$i<br>";
$handle = fopen('test.dat', "a");
fwrite($handle, $i . "\n");
fclose($handle);
}

print '<br><br>End...<br>';

?>

Thanks...


It's strange, looks like apache ignores your php.ini. You can yet try to
add set_time_limit(30); to the beginning of your code. After 30 seconds
the script should end with php generated-error, so the last line never
prints. If set_time_limit will work, try to find if you are not using
another php.ini than you are trying to edit ;)

Y.
Nov 22 '05 #2

P: n/a
Hi,

I want to configure php and the webserver not to let run scripts
endless like mine. So I don't want to tell my friends on my server to
do it like that, because they are users and I can't trust on that.

I checked with phpinfo(); the path to php.ini:

Configuration File (php.ini) Path: /etc/php4/apache2/php.ini

And that's the php.ini i am working with.

I got a debian sarge installation. So there must be a way to configure
what i want.

I hope.

Thanks...

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.