php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50531 CLI script stops at fatal error: Maximum execution time of 200 seconds exceeded
Submitted: 2009-12-19 11:20 UTC Modified: 2009-12-29 01:00 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: net_php at mojocafe dot jp Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.3.1 OS: OS 10.6.2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-12-19 11:20 UTC] net_php at mojocafe dot jp
Description:
------------
I have a long running script that crashes with the following message:

PHP Fatal error:  Maximum execution time of 200 seconds exceeded in 
xxx on line xxx


Whichever I used I get the above timeout of 200 seconds after maybe 
10-20 minutes of the script running. I can't find 200 seconds anywhere 
in any of the settings.

Strangely too it seems always to give the same line unless I change 
the script in which case it gives another line with a different 
function. i.e. an unchanged script gives the error in the same place 
but a change script gives it at a different place.

(Note: a previous bug report was erroneously marked at bogus because I 
reported that the crash for two different machines).

Reproduce code:
---------------
20:04:59 $ php --version
PHP 5.3.1 (cli) (built: Dec 19 2009 16:49:18) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

# grep max_execution_time /usr/local/etc/php.ini
max_execution_time = 30     ; Maximum execution time of each script, in
seconds

Expected result:
----------------
Expect the script to run till completion.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-21 10:21 UTC] jani@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2009-12-21 10:32 UTC] net_php at mojocafe dot jp
Thanks for the response. As noted this happens on a number of different 
installs with exactly the same result. One weird thing is that the loop 
always crashes at between the 566 and 569th iteration. Always close but 
not the same. I even tried removing the .ini file with the same result.

There is a shell_exec in the loop, but watching the last time exactly as 
it stopped with a fatal error there was no load issue on the server, but 
where the line number indicated a different place (there seems to be no 
pattern here).

Since PHP itself doesn't seem to be crashing but the script is giving a 
fatal error, I'm not quite sure what the best approach for giving you more 
information is.
 [2009-12-21 10:41 UTC] aharvey@php.net
Run "php --ini" in a terminal and check which configuration files are actually being loaded. Chances are that something else is being loaded that you're unaware of. (Particularly since the default in PHP is 30 seconds, and so far as I can tell, there's nowhere in the PHP source code that could magically set the value to 200 seconds.)
 [2009-12-21 10:47 UTC] net_php at mojocafe dot jp
$ php --ini
Configuration File (php.ini) Path: /usr/local/etc
Loaded Configuration File:         /usr/local/etc/php.ini
Scan for additional .ini files in: /usr/local/etc/php
Additional .ini files parsed:      /usr/local/etc/php/extensions.ini


$ grep 200 /usr/local/etc/php/extensions.ini

$ grep 200 /usr/local/etc/php.ini
; Enforce year 2000 compliance (will cause problems with non-compliant 
browsers)
memory_limit = 200M      ; Maximum amount of memory a script may consume 
(128MB)
; if cgi.nph is enabled it will force cgi to always sent Status: 200 with
; does not currently support this feature (03/17/2002)

I've looked everywhere for the 200 and I can't find one anywhere. Also the 
script is not terminating after 200 seconds but more like half-an-hour.

Thanks.
 [2009-12-21 11:31 UTC] jani@php.net
First of all, this is NOT any crash. Does it happen on command line? What does this output:

# php -i | grep _time
 [2009-12-21 11:39 UTC] net_php at mojocafe dot jp
Sorry, yes, the original submission uses the word 'crash' but that was 
mistaken: 'terminates with fatal error' is what I meant.

11:36:44 $ php -i | grep _time
allow_call_time_pass_reference => On => On
max_execution_time => 0 => 0
max_input_time => -1 => -1
mysql.connect_timeout => 180 => 180
default_socket_timeout => 60 => 60
 [2009-12-21 11:41 UTC] net_php at mojocafe dot jp
Yes. This is a CLI script.
 [2009-12-21 12:11 UTC] jani@php.net
The obvious next question is: Where's the reproducing script..?
 [2009-12-21 12:14 UTC] jani@php.net
Maybe this is same as bug #49868 (max_execution_time affected by max_input_time). So try the latest snapshot first.
 [2009-12-21 12:23 UTC] net_php at mojocafe dot jp
I think it is not that latter script because other basic scripts don't 
time out.
 [2009-12-21 13:59 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-12-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 02:01:29 2024 UTC