[PHP] Execution time
Hello everyone. This may seem as a silly question, but I went through the documentation and it wasn't explicit on this issue, at least for me. Let's say that I'm on an 128kb/s upload. I need to upload an 100mb file through a POST. PHP has, by default, 90 seconds execution limit time. So, the question is, when I hit the submit button, does it start timing? Or does it start timing when the PHP gets the FULL POST headers? Thanks in advance, André -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execution time of ';'
Andy Pieters wrote: Hi all We develop our software with built-in debug handlers that are very talkative. Each class registers itself to a central debug handler. When a conditional define NODEBUG is set, that debughandler just does a return null but obviously it takes time to perform that call. We are thinking of doing a search/replace on the source to replace all $this->debug('...'); with a ; because if I would replace it with a # it would generate errors in cases like this: if(conditions ) $this->debug('something...'); asumming replacing the call with ; is valid everywhere it's going to a heck of a lot faster than calling _any_ function. So here is the question: Are there any reasons against doing this kind of replace, or is anyone aware of a better solution? 1. use a debugger rather than writing lots of code that logs tons of 'cr*p'? 2. always use braces? so that you can do: if(conditions ) { # $this->debug('something...'); } 3. may put special comment markers in your code that allow you to filter the files when you 'publish' them into a production env. /*START_DEBUG_BLOCK*/ if(conditions ) $this->debug('something...'); /*END_DEBUG_BLOCK*/ i.e strip the blocks completely: $newFile = preg_replace( '#/\*START_DEBUG_BLOCK\*/.*/\*END_DEBUG_BLOCK\*/#', '', file_get_contents( $yourPhpFile ) ); With kind regards Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execution time of ';'
Hi all We develop our software with built-in debug handlers that are very talkative. Each class registers itself to a central debug handler. When a conditional define NODEBUG is set, that debughandler just does a return null but obviously it takes time to perform that call. We are thinking of doing a search/replace on the source to replace all $this->debug('...'); with a ; because if I would replace it with a # it would generate errors in cases like this: if(conditions ) $this->debug('something...'); So here is the question: Are there any reasons against doing this kind of replace, or is anyone aware of a better solution? With kind regards Andy -- Registered Linux User Number 379093 Now listening to Virtual Zone - Virtual Zone amaroK::the Coolest Media Player in the known Universe! Cockroaches and socialites are the only things that can stay up all night and eat anything. Herb Caen -- -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++ L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e>$@ h++(*) r-->++ y--()> -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- pgpb1XjyVb78d.pgp Description: PGP signature
RE: [PHP] Execution time?
Take a timestamp at the beginning or your script and at the end (subtract) and you have the execution time (reasonably precisely) plus or minus a few microseconds. http://www.php.net/manual/en/function.microtime.php Warren Vail > -Original Message- > From: Peter Lauri [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 01, 2004 7:02 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Execution time? > > > Best groupmember, > > How do I find the execution time for a php-script on a webserver? ms? > > -- > - Best Of Times > /Peter Lauri > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execution time?
Best groupmember, How do I find the execution time for a php-script on a webserver? ms? -- - Best Of Times /Peter Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Logging PHP Execution time to a file?
On Jul 14, 2003, "Marek Kilimajer" claimed that: |I use this function: |function echo_pt($add='') { | static $pt = 0; | if($pt==0) { | $pt = miro_time(); | return; | } | $time_start = explode(' ', $pt); | $time_end = explode(' ', microtime()); | $parse_time = number_format(($time_end[1] + $time_end[0] - | ($time_start[1] + $time_start[0])), 3); | echo ''; | $pt=microtime(); |} | |Usage: |it needs to be initialized first: |echo_pt(); |then simply call as many times as you need: |echo_pt('some string'); |and it will show you seconds elapsed from the last call to this |function, so you can easily see where the script spends most of its |time. Instead of echoing it you can append it to a file. | |Lasse Laursen wrote: | |> Hi all, |> |> We are "debugging" some web applications to try to determine where the |> problems with long execution time is. |> |> Is it possible to log the execution time of each script executed to a |> logfile? The PHP processes are run as FastCGI under Zeus. |> |> Regards |> -- |> Lasse Laursen · VP, Hosting Technology · NetGroup A/S |> St. Kongensgade 40H · DK-1264 Copenhagen K, Denmark |> Phone: +45 3370 1526 · Fax: +45 3313 0066 |> |> - Don't be fooled by cheap finnish imitations - BSD is the One True Code |> -- It seems to me that many people (usually CMS systems or shopping carts) try to re-invent the wheel. The pear repository is filled with many packages, hopefully more to come, and the Benchmark Package is one of them. require_once "Benchmark/Timer.php"; $timer = new Benchmark_Timer; $timer -> start(); // Plenty of code... $timer -> stop(); print("\n"); Jeff -- Registered Linux user #304026. "lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import" Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Logging PHP Execution time to a file?
I use this function: function echo_pt($add='') { static $pt = 0; if($pt==0) { $pt = miro_time(); return; } $time_start = explode(' ', $pt); $time_end = explode(' ', microtime()); $parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3); echo ''; $pt=microtime(); } Usage: it needs to be initialized first: echo_pt(); then simply call as many times as you need: echo_pt('some string'); and it will show you seconds elapsed from the last call to this function, so you can easily see where the script spends most of its time. Instead of echoing it you can append it to a file. Lasse Laursen wrote: Hi all, We are "debugging" some web applications to try to determine where the problems with long execution time is. Is it possible to log the execution time of each script executed to a logfile? The PHP processes are run as FastCGI under Zeus. Regards -- Lasse Laursen · VP, Hosting Technology · NetGroup A/S St. Kongensgade 40H · DK-1264 Copenhagen K, Denmark Phone: +45 3370 1526 · Fax: +45 3313 0066 - Don't be fooled by cheap finnish imitations - BSD is the One True Code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Logging PHP Execution time to a file?
I use this: function getmicrotime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec*1000); } // Start script $time=getmicrotime(); ... ... ... // Script finished echo "Page was generated in ".sprintf("%01.7f",((getmicrotime()-$time)/1000))." seconds."; You can see it at http://hydra.emo-cz.net/rivia at the bottom of each page (not in english :o( ) Emo "Lasse Laursen" <[EMAIL PROTECTED]> píe v diskusním príspevku news:[EMAIL PROTECTED] > Hi all, > > We are "debugging" some web applications to try to determine where the > problems with long execution time is. > > Is it possible to log the execution time of each script executed to a > logfile? The PHP processes are run as FastCGI under Zeus. > > Regards > -- > Lasse Laursen · VP, Hosting Technology · NetGroup A/S > St. Kongensgade 40H · DK-1264 Copenhagen K, Denmark > Phone: +45 3370 1526 · Fax: +45 3313 0066 > > - Don't be fooled by cheap finnish imitations - BSD is the One True Code > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Logging PHP Execution time to a file?
Hi all, We are "debugging" some web applications to try to determine where the problems with long execution time is. Is it possible to log the execution time of each script executed to a logfile? The PHP processes are run as FastCGI under Zeus. Regards -- Lasse Laursen · VP, Hosting Technology · NetGroup A/S St. Kongensgade 40H · DK-1264 Copenhagen K, Denmark Phone: +45 3370 1526 · Fax: +45 3313 0066 - Don't be fooled by cheap finnish imitations - BSD is the One True Code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Execution Time
Edit your php.ini, change "max_execution_time" to something greater than 30. Mark > -Original Message- > From: Pong-TC [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 04, 2002 2:44 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Execution Time > > > Hello All > > I have a problem with the execution time. I use PHP to > update database, > but it could not perform well due to the limited execution time. How > could I extend the execution time? Here is my error: > > Fatal error: Maximum execution time of 30 seconds exceeded in > d:\inetpub\wwwroot\cgi-bin\finaid\upfinwhole.php on line 468 > > I am using PHP on IIS5 as a cgi. > > Thank you. > Pong > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execution Time
Hello All I have a problem with the execution time. I use PHP to update database, but it could not perform well due to the limited execution time. How could I extend the execution time? Here is my error: Fatal error: Maximum execution time of 30 seconds exceeded in d:\inetpub\wwwroot\cgi-bin\finaid\upfinwhole.php on line 468 I am using PHP on IIS5 as a cgi. Thank you. Pong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execution time
> I have a php script that runs every 30 minutes. It takes the contents of a > directory (which is constantly being updated) and dumps them into a mysql > database. Recently this directory has become increasingly large and the php > script only updates a portion of it before it stops execution. > > To run the php script I use a lynx command in a crontab. I'm running suse > linux and apache on both machines (the machine containting the directory > and the other machine containing the database). Sounds like you're trying to hammer a nail with a flower pot :) You should compile and install the cgi version of php, which can be run from the command line like perl, with php -q. Remember that you'll need to declare the location of the php app just like in perl scripts. :) > I've tried changing the max execution time in php.ini file but it appears > to have no affect. When I took the php script and divided it into portions > and ran them one at a time it worked (except for one portion of the > script). the execution time of the script doesn't matter to me, I just need > it to run. It's been a while since I looked into this, but I _think_ setting it to 0 makes it infinite. I think. > When I run the php script through a browser, and the script doesn't > complete, I get a 'page cannot be displayed' message (while I am expecting > a 'fatal error, exceeded max execution time' error message). > > Maybe it could be fixed by using something other than lynx to run the php > script internally, but I don't know of any alternatives. > > hope someone can help.. cron with command line php :) _a -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] execution time
http://www.php.net/manual/en/function.set-time-limit.php the set_time_limit allows you to reset the max execution time.. the manual says: 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. Wagner Tomy Editus S.A. - Original Message - From: "Pétur Björn Thorsteinsson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 27, 2001 2:03 PM Subject: [PHP] execution time > > I have a slight problem and was wondering if anyone could help. > > I have a php script that runs every 30 minutes. It takes the contents of a > directory (which is constantly being updated) and dumps them into a mysql > database. Recently this directory has become increasingly large and the php > script only updates a portion of it before it stops execution. > > To run the php script I use a lynx command in a crontab. I'm running suse > linux and apache on both machines (the machine containting the directory > and the other machine containing the database). > > I've tried changing the max execution time in php.ini file but it appears > to have no affect. When I took the php script and divided it into portions > and ran them one at a time it worked (except for one portion of the > script). the execution time of the script doesn't matter to me, I just need > it to run. > > When I run the php script through a browser, and the script doesn't > complete, I get a 'page cannot be displayed' message (while I am expecting > a 'fatal error, exceeded max execution time' error message). > > Maybe it could be fixed by using something other than lynx to run the php > script internally, but I don't know of any alternatives. > > hope someone can help.. > > > -petur > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] execution time
You can use a standalone compiled PHP version and then You will not need a browser to execute scripts see http://www.php.net/manual/en/install.commandline.php - Original Message - From: "Pétur Björn Thorsteinsson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday 27 July 2001 ?. 3:03 PM Subject: [PHP] execution time I have a slight problem and was wondering if anyone could help. I have a php script that runs every 30 minutes. It takes the contents of a directory (which is constantly being updated) and dumps them into a mysql database. Recently this directory has become increasingly large and the php script only updates a portion of it before it stops execution. To run the php script I use a lynx command in a crontab. I'm running suse linux and apache on both machines (the machine containting the directory and the other machine containing the database). I've tried changing the max execution time in php.ini file but it appears to have no affect. When I took the php script and divided it into portions and ran them one at a time it worked (except for one portion of the script). the execution time of the script doesn't matter to me, I just need it to run. When I run the php script through a browser, and the script doesn't complete, I get a 'page cannot be displayed' message (while I am expecting a 'fatal error, exceeded max execution time' error message). Maybe it could be fixed by using something other than lynx to run the php script internally, but I don't know of any alternatives. hope someone can help.. -petur -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] execution time
I have a slight problem and was wondering if anyone could help. I have a php script that runs every 30 minutes. It takes the contents of a directory (which is constantly being updated) and dumps them into a mysql database. Recently this directory has become increasingly large and the php script only updates a portion of it before it stops execution. To run the php script I use a lynx command in a crontab. I'm running suse linux and apache on both machines (the machine containting the directory and the other machine containing the database). I've tried changing the max execution time in php.ini file but it appears to have no affect. When I took the php script and divided it into portions and ran them one at a time it worked (except for one portion of the script). the execution time of the script doesn't matter to me, I just need it to run. When I run the php script through a browser, and the script doesn't complete, I get a 'page cannot be displayed' message (while I am expecting a 'fatal error, exceeded max execution time' error message). Maybe it could be fixed by using something other than lynx to run the php script internally, but I don't know of any alternatives. hope someone can help.. -petur -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]