RE: [PHP] set_time_limit() on Mac

2003-10-07 Thread Jay Blanchard
[snip]
i'm under the impression that max execution time / set_time_limit() is
server specific, and completely independant of what computer is being
served
the pages?
[/snip]

Not server specific and overrides whatever you have set in php.ini and
httpd.conf for the page in which the set_time_limit is contained.
set_time_limit(10) limits the script to 10 seconds.

[quote]
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. 
[/quote]

So your script is running for a certain length of time, then it hits the
set_time_limit function and quits after 10 more seconds. Set your time
limit up and see if it completes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] set_time_limit() on Mac

2003-10-07 Thread Chris Kranz
i gotta wierd one, maybe it's just me being daft...

i'm under the impression that max execution time / set_time_limit() is
server specific, and completely independant of what computer is being served
the pages?

my server is apache 1.3 running php 4.3 on win 2k...

when i run the script from a windows machine, it runs fine. my line that
does a set_time_limit(10) works and the script happily runs for about 2
minutes while a loop does some file copying (across the network to the
server, and independant of whatever machine called the script).

however, if i run the same script from my little iMac (shudders) then it'll
give me a script timeout saying it's gone over the max execution time of 10.
now i know that set_time_limit(10) is being run, as the server default is
30. it just doesn't seem to be resetting this value in the PHP loop. but
surely that's impossible, as it should be all server side?

secondly, i have a timer that (using javascript) writes to the html page how
long the script has been running, and an estimate of how long is left to
run. again, perfect timing on the PC, but when run from the Mac, the timer
counts 1 second roughly every 2 seconds. again, surely this is impossible as
time functions are run from the server???

the other strange thing, if i have the script running off a PC, and the Mac
then also runs it, it'll time perfectly... it'll still time out, but it'll
atleast count proper seconds...

here's a rough idea of the code... i've cut out most of the crap that it
does to give you an idea of what's happening, ignore any syntax errors, as
the script does work... the flush() works nicely to update my form fields
with javascript so i can see the live results of the script working... and
see the problems with how mac seems to be handling it.

anyway, any ideas would be very appreciated, as i don't want to have to
fudge it and stick set_time_limit(1000) at the beginning of the page :(

---code---




 Imposition Uploader
 

 function name(label)
 {
  document.all.currentName.value=label;
 }
 function add(name)
 {
  document.all[name].value++;
 }
 function time(estimate,taken)
 {
  document.all.timeEstimate.value=estimate;
  document.all.timeTaken.value=taken;
 }

 


";
echo"total files read: ";
echo"total files copied: ";
echo"total errors: ";
echo"total edits: ";
echo"db records deleted: ";
echo"db records updated: ";
echo"new db records: ";
echo"";
echo"estimated time: ";
echo"time taken: ";
flush();
//read in a csv file line by line
foreach($csv as $record)
{
 $counter++;
 set_time_limit(10); //this doesn't work for mac!!
  if(file_exists($file))
  {
//do some file copying across the network. $file is located on
NFS and copied to the server...
//also run some extra functions to update our form counters with
JS
  }
  $estimate = round(($sofar/$counter)*$rows);
  $sofar = round(getmicrotime($start));
  echo "time('$estimate','$sofar');";
  echo "";
  flush();
 }
?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php