NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP-CLI Timeout

Chris Bielanski Cbielanski at inta.org
Tue Dec 28 10:18:25 EST 2004


I'm afraid the set_time_limit(-1); threw an error. I decided to use a bad
idea to get me through the crunch and I'm calling set_time_limit(60) in my
processing loops.

per the Fine Manual:
"When called, set_time_limit() restarts the timeout counter from zero. In
other words, if the timeout is the default 30 seconds, and 25 seconds into
script execution a call such as set_time_limit(20) is made, the script will
run for a total of 45 seconds before timing out."

...mmmm. Just the kind of ingredients one needs for a dirty hack...

PHP -v tells me I have v. 4.3.4 (cgi-fcgi)


Thanks,
Chris Bielanski
Web Programmer, 
International Trademark Association,
1133 Avenue of the Americas, 33rd Floor
New York, NY 10036
+1 (212) 642-1745, f: +1 (212) 768-7796
mailto:cbielanski at inta.org, www.inta.org  
INTA -- 125 Years of Excellence



> -----Original Message-----
> From: Hans Zaunere [mailto:hans at nyphp.com]
> Sent: Tuesday, December 28, 2004 10:09 AM
> To: NYPHP Talk
> Subject: RE: [nycphp-talk] PHP-CLI Timeout
> 
> 
> 
> > > I'm trying to parse a number of large webserver logs into 
> a DB and I
> would
> > > prefer to use PHP as its our shop's lingua franca. How do 
> I keep PHP
> from
> > > timing out the script after 30 seconds (or whatever I use in
> set_timeout())?
> > > Is there a method for running a script on the command line that
> doesn't
> > > terminate like this?
> > 
> > set_time_limit(-1);
> > // http://us2.php.net/manual/en/function.set-time-limit.php
> > // http://us2.php.net/manual/en/ref.info.php#ini.max-execution-time
> > 
> > This will let the script run indefinately depending on your system
> > settings (max_execution_time).
> 
> Also, if this is a 4.3.x version of PHP, and it's truly compiled as a
> CLI (not a CGI) an execution time limit doesn't exist.
> 
> 
> ---
> Hans Zaunere
> President, Founder
> New York PHP
> http://www.nyphp.org
> 
> 
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
> 



More information about the talk mailing list