Re: [PHP] Timing problem, putting PNG into PDF
I'm using GD to crop save an uploaded image, and then embedding it into a PDF made with FPDI. It works great when the image is small or low-res. When the uploaded file is bigger, more than a couple hundred K or so, it fails. I think that the image is not done writing yet by the time I try to do the $pdf-Image. Any suggestions? Some way to force it to hang out and pause until the image is done writing? I know that this is naive but maybe sleep will do the job. Try to write the file and then put something like sleep(2) to give it time to finish the IO. http://www.php.net/manual/en/function.sleep.php -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing problem, putting PNG into PDF
2008/8/12 Brian Dunning [EMAIL PROTECTED]: I'm using GD to crop save an uploaded image, and then embedding it into a PDF made with FPDI. It works great when the image is small or low-res. When the uploaded file is bigger, more than a couple hundred K or so, it fails. I think that the image is not done writing yet by the time I try to do the $pdf-Image. Any suggestions? Some way to force it to hang out and pause until the image is done writing? It's more likely you're hitting a memory limit in your script. Pare your script down to just the resize action, and turn error reporting on. What function are you calling to do the resize? It shouldn't return until it's finished processing. BTW, ImageMagick produces smoother results than GDLib when resizing. -- http://www.otton.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing out a remote call
Brian Dunning wrote: For one project, I'm required to access a web service for every page. Basically it returns a little bit of random text. I have no control over the web service, and there is no possibility of cacheing or bringing it locally: the requirements are that it be accessed live across the Internet every time. Most times it's instantaneous, but sometimes it can hang. I want to give it a half-second timeout, which we're allowed to do, but there's no documentation provided. Here is how we call it now (really simple): include('http://04planet.info/kfc/grab_one.php'); I have STFW and RTFM and could only find vague references like use fsockopen instead or stream_set_timeout() but I can't find an actual complete working example anywhere. Any pointers? Generally, using include or file_get_contents() for a remote call is a Bad Idea. Perhaps if you used curl instead? You have a lot more control over the entire call that way. Of course, the curl code might be a bit bulkier in PHP, but I find it works quite well. As for fsockopen(), it works just like a file pointer. http://www.php.net/manual/en/function.fsockopen.php That manual page gives a pretty good description of how to use it. Idea: The socket will by default be opened in blocking mode. You can switch it to non-blocking mode by using stream_set_blocking(). The last parameter to fsockopen() is the timeout for connecting to the socket, and the manual describes it as such: Note: If you need to set a timeout for reading/writing data over the socket, use stream_set_timeout(), as the timeout parameter to fsockopen() only applies while connecting the socket. Regards, Torgny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing on an internal email
Not necessarily outside of php, but outside of webserver. You need to setup a cron job that will execute the phpmailer script. Gotcha.., My webserver is a windows box, so I can just run a task schedule and give it; php.exe myfile.php and that should do it? Would it be more efficient as a command line task or as an instance of the browser? You can use a windows version of cron, find it here: http://www.kalab.com/freeware/cron/cron.htm Or, if you don't want to or can't install it - you can ask somebody with a linux server/machine to setup a cron script that does a request to a webpage that should send the emails. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing on an internal email
Alex Hogan wrote: Hi all, I want to set up a delivery date and time for emails to be sent. (I'm using phpmailer) I'm coming up blank on how to do this. I thought that I could put a timing condition on a page that I know will be accessed daily that would look for the date then call the function that will do the mail outs on the appropriate date, but there has to be a better way. Sure. Is this something that I'll have to do outside of php? Not necessarily outside of php, but outside of webserver. You need to setup a cron job that will execute the phpmailer script. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing on an internal email
Not necessarily outside of php, but outside of webserver. You need to setup a cron job that will execute the phpmailer script. Gotcha.., My webserver is a windows box, so I can just run a task schedule and give it; php.exe myfile.php and that should do it? Would it be more efficient as a command line task or as an instance of the browser? alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing a MySQL response
Richard Davey wrote: Just a quick question - but does anyone know how to get the ms value back from MySQL that tells you how long it took to run your query? That value is not returned at all. Go with the wrapper... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] timing a session
Damian Brown wrote: Hi, i haven't looked into it properly yet, but is there a way in PHP of recording the length of time a visitor stays on your website i can record the entry, but i don't know how to record the exit time There is no way to get this exactly! You cannot record the time a user is really reading a single page. It has to do something with the http protocol being 'connectionless'! I heared/read that there's a standard of the 'advertisment-industry' saying that a visit ends after 30 minutes after the last (session-)request. (A bad method if you really must have this very exact is to do a short http-refresh, eg every minute.) I also think, this is no php problem but a common problem of the http protocol which wasn't designed to hold a connection over a user's session - that's why session management had to be invented ;-) Regards, Matthias Regards, Damian www.phpexpert.org UK FREEphone 0800 019 0924 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] timing a session
Damian Brown wrote: i haven't looked into it properly yet, but is there a way in PHP of recording the length of time a visitor stays on your website i can record the entry, but i don't know how to record the exit time There's really no way to do this, only ways to estimate the time. Assign each user a unique id (session_id or a username) and record the time during each request. After there are no more requests for X minutes (your choice), then consider the session terminated. If you are using session, one possibility may be to use your own handler and write a garbage collection routine that records the age of the session file as it's cleaned up. You can consider the age of the session file as the time that the user was on your site. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing out fopen using https stream wrapper?
It seems I have been over the documentation repeatedly, but there simply isn't any documented way of setting a timeout duration. Any ideas? If you want to set a time out on execution of the /script/, check out: http://us3.php.net/manual/en/function.set-time-limit.php -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing out fopen using https stream wrapper?
This has no effect on stream operations. I have a timeout set in php.ini, but the script never times out, so that should further illustrate the issue. -Original Message- From: Dan Anderson [mailto:[EMAIL PROTECTED] Sent: Saturday, July 05, 2003 5:11 AM To: Giz Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Timing out fopen using https stream wrapper? It seems I have been over the documentation repeatedly, but there simply isn't any documented way of setting a timeout duration. Any ideas? If you want to set a time out on execution of the /script/, check out: http://us3.php.net/manual/en/function.set-time-limit.php -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing out fopen using https stream wrapper?
That only works to set a timeout on reading data once the fopen has successfully returned. The problem is that the fopen function is hanging. -Original Message- From: Arjen Brouwer [mailto:[EMAIL PROTECTED] Sent: Saturday, July 05, 2003 6:08 AM To: Giz Subject: Re: [PHP] Timing out fopen using https stream wrapper? check: http://php.net/stream_set_timeout - Original Message - From: Giz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, July 05, 2003 2:09 PM Subject: [PHP] Timing out fopen using https stream wrapper? I have a class that uses fopen to read some xml data from a site with ongoing stability issues. Fopen is using the stream wrapper for http. Something I've struggled with is finding a way to set a timeout value when fopen is attempting to get a page from a site that is inaccessible for some reason. On my test server, the behavior is that fopen seems to hang up, and the script never returns. It seems I have been over the documentation repeatedly, but there simply isn't any documented way of setting a timeout duration. Any ideas? -- 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
RE: [PHP] Timing out fopen using https stream wrapper?
This has no effect on stream operations. I have a timeout set in php.ini, but the script never times out, so that should further illustrate the issue. But if you'd visited the page I sent you and viewed user comments you would see how to set a time limit for socket operations (what you're doing). -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing out fopen using https stream wrapper?
I've looked at that page extensively and seen nothing there that would handle my issue, long before I ever mailed the problem to this list. What in particular from there did you see that would be useful to my use of fopen('http://etc')? -Original Message- From: Dan Anderson [mailto:[EMAIL PROTECTED] Sent: Saturday, July 05, 2003 5:28 PM To: Giz Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Timing out fopen using https stream wrapper? This has no effect on stream operations. I have a timeout set in php.ini, but the script never times out, so that should further illustrate the issue. But if you'd visited the page I sent you and viewed user comments you would see how to set a time limit for socket operations (what you're doing). -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing out fopen using https stream wrapper?
From the user comments: I think it might be useful to point out that set_time_limit() doesn't have any effect on stream operations. A stalled script, either during open operations (e.g. fsockopen()) or read operations (e.g. fgets()), can make your script run forever. So it would be advisable to define timeouts for opening sockets (with the timeout parameter in fsockopen()) and for reading data from sockets (with socket_set_timeout()). So, yes, you would have had to go to: http://us3.php.net/manual/en/function.fsockopen.php Sorry about that but I didn't exactly have lots of time on my hands at the time to give you more details. -Dan On Sat, 2003-07-05 at 21:27, Giz wrote: I've looked at that page extensively and seen nothing there that would handle my issue, long before I ever mailed the problem to this list. What in particular from there did you see that would be useful to my use of fopen('http://etc')? -Original Message- From: Dan Anderson [mailto:[EMAIL PROTECTED] Sent: Saturday, July 05, 2003 5:28 PM To: Giz Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Timing out fopen using https stream wrapper? This has no effect on stream operations. I have a timeout set in php.ini, but the script never times out, so that should further illustrate the issue. But if you'd visited the page I sent you and viewed user comments you would see how to set a time limit for socket operations (what you're doing). -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing out fopen using https stream wrapper?
Thanks for the reply, Well hopefully this will help narrow down the issue. With Fsockopen a timeout can be passed, however, this is using fopen. I am hoping there may be some obscure way of setting a timeout but so far, I've not been able to find one. -Original Message- From: Dan Anderson [mailto:[EMAIL PROTECTED] Sent: Saturday, July 05, 2003 6:26 PM To: Giz Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Timing out fopen using https stream wrapper? From the user comments: I think it might be useful to point out that set_time_limit() doesn't have any effect on stream operations. A stalled script, either during open operations (e.g. fsockopen()) or read operations (e.g. fgets()), can make your script run forever. So it would be advisable to define timeouts for opening sockets (with the timeout parameter in fsockopen()) and for reading data from sockets (with socket_set_timeout()). So, yes, you would have had to go to: http://us3.php.net/manual/en/function.fsockopen.php Sorry about that but I didn't exactly have lots of time on my hands at the time to give you more details. -Dan On Sat, 2003-07-05 at 21:27, Giz wrote: I've looked at that page extensively and seen nothing there that would handle my issue, long before I ever mailed the problem to this list. What in particular from there did you see that would be useful to my use of fopen('http://etc')? -Original Message- From: Dan Anderson [mailto:[EMAIL PROTECTED] Sent: Saturday, July 05, 2003 5:28 PM To: Giz Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Timing out fopen using https stream wrapper? This has no effect on stream operations. I have a timeout set in php.ini, but the script never times out, so that should further illustrate the issue. But if you'd visited the page I sent you and viewed user comments you would see how to set a time limit for socket operations (what you're doing). -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] timing out exec statements
Wouldn't this be best done inside your perl script? That way you can have it retry a few times then if it hard fails return to the PHP script. Brad - Original Message - From: Dave [Hawk-Systems] [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Monday, June 16, 2003 11:55 AM Subject: [PHP] timing out exec statements we are dropping to a perl script to process transactions, occasionally the remote server the perl script interacts with becomes bogged, the transaction goes into limbo, or for whatever reason the processing of that transaction hangs (happening about 0.2% of the time). Is there a way to time and timeout the exec statement... just assume it has failed, ditch the execution, and handle the failed transaction after X seconds? The alternative we have is to run the exec and redirect the return results to another script so that no single exec would graing the whole master php script to a halt. thoughts? Dave -- 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
RE: [PHP] Timing test of the parser... Makes no difference
here is the trick the solaris guy showed me , i've intergrated it into a webpage for showing the results time php somebenchmark.php /dev/null time will show u the results of the compiling , the microtime version has to allow time for running through apache :) = Original Message From Daevid Vincent [EMAIL PROTECTED] = It seems that it makes almost no difference if you switch in and out of the parser or stay within it... Does this seem like a fair test? Having said that, I would suggest always using the first method as it's much cleaner to read and color coding works in most editors. -- output --- version one: 0.098537087440491 seconds version two: 0.096035003662109 seconds --- test --- ?php function getmicrotime(){ list($usec, $sec) = explode( ,microtime()); return ((float)$usec + (float)$sec); } $ITERATIONS = 1; $time_start = getmicrotime(); for ($i = 1; $i $ITERATIONS; $i++) { ? blah ?=$i? ?php } $time_end = getmicrotime(); $time1 = $time_end - $time_start; $time_start = getmicrotime(); $tf = TRUE; for ($i = 1; $i $ITERATIONS; $i++) { echo blah .$i.\n; } $time_end = getmicrotime(); $time2 = $time_end - $time_start; echo Pversion one: \t$time1 secondsP\n; echo version two: \t$time2 secondsP\n; ? -- 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
Re: [PHP] Timing mySQL query time.
Why not just get the query times from the mysql general query log? On Tue, 24 Dec 2002, Noodle Snacks wrote: Is there a built in php function for mysql that I can use to time the last query? or do I have to take the microtime before and after then substract the first from the last? I want to time how long my queries take -- 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
Re: [PHP] Timing mySQL query time.
Can I do that on the fly? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Why not just get the query times from the mysql general query log? On Tue, 24 Dec 2002, Noodle Snacks wrote: Is there a built in php function for mysql that I can use to time the last query? or do I have to take the microtime before and after then substract the first from the last? I want to time how long my queries take -- 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
Re: [PHP] timing header(Location: )
On Thursday, July 25, 2002, at 01:02 PM, JJ Harrison wrote: Is it possible to make the browser wait say, 5 seconds before redirection by outputting headers? I know you can do it with meta tags but not how by outputting headers http://www.php.net/manual/en/function.sleep.php R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing PHP
microtime() function's manual entry tells you exactly what you want to do. :) Niklas -Original Message- From: Stig Kronback [mailto:[EMAIL PROTECTED]] Sent: 18. maaliskuuta 2002 12:00 To: [EMAIL PROTECTED] Subject: [PHP] Timing PHP Dear ? I need to see how long it takes for my php-scripts to execute, what can I do, doesn't PHP include a function that will show that information? Regards, Stig = Stig Kronback Andersen Drejervej 13, st 2400 Koebenhavn NV Denmark Phone: +45 35310382 E-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- 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
Re: [PHP] Timing PHP
On Mon, 18 Mar 2002, Stig Kronback wrote: I need to see how long it takes for my php-scripts to execute, what can I do, doesn't PHP include a function that will show that information? PEAR has a benchmark class which does just that: http://chora.php.net/cvs.php/pear/Benchmark -- Mika Tuupola http://www.appelsiini.net/~tuupola/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing Sessions Out
Right you are, seconds. -Original Message- At 03:21 PM 2/19/2002 Tuesday, Johnson, Kirk wrote: See session.gc_maxlifetime in php.ini. Kirk I assume that the value given is in seconds. Correct?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing Sessions Out
See session.gc_maxlifetime in php.ini. Kirk -Original Message- From: Phillip S. Baker [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 4:10 PM To: PHP Email List Subject: [PHP] Timing Sessions Out Hey Gents and Ladies, I read that sessions can be set to timeout after a certain period of time. However I have not come across anything that tells me how to do that. So how do I specify when sessions are to timeout? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timing Sessions Out
At 03:21 PM 2/19/2002 Tuesday, Johnson, Kirk wrote: See session.gc_maxlifetime in php.ini. Kirk I assume that the value given is in seconds. Correct?? Thank you for the response. Phillip -Original Message- From: Phillip S. Baker [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 4:10 PM To: PHP Email List Subject: [PHP] Timing Sessions Out Hey Gents and Ladies, I read that sessions can be set to timeout after a certain period of time. However I have not come across anything that tells me how to do that. So how do I specify when sessions are to timeout? -- 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
RE: [PHP] timing
If the other application is written in PHP you can use flock. Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 11:00 AM To: Php-General Subject: [PHP] timing I have a script that when is executed parses and html file and writes the contents to a text file. I need to then read this text file from another apllication Is there a way of timing this operation, so that my other app does not try to access the file before being written? -- 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] timing
unfortunaelty its not in php- but director -Original Message- From: Matthew Luchak [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 16:03 To: Php-General Subject: RE: [PHP] timing If the other application is written in PHP you can use flock. Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 11:00 AM To: Php-General Subject: [PHP] timing I have a script that when is executed parses and html file and writes the contents to a text file. I need to then read this text file from another apllication Is there a way of timing this operation, so that my other app does not try to access the file before being written? -- 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] -- 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]