Re: [PHP] running python in php timeout

2008-12-29 Thread Lars Torben Wilson
2008/12/29 brad :
> Hi,
>
> I'm executing a python script from php that runs quite a long time (15+
> minutes) and ends up timing out. Is there a way I can execute the python
> code and move on executing the remaining php code on the page?
> Thanks!

Hi Brad,

It's a little tough to say for sure since you didn't specify your OS
or platform (always good info to include), but if you're on *nix then
you'll need to tell the child process to run in the background and
redirect the output from the child process to somewhere else (say, a
log file). You also didn't say how you're executing the child process,
but here's a common way to do it using backticks:

`/path/to/executable "$arg1" "$arg2" >> /path/to/logfile.log 2>&1 &`

The '>> /path/to/logfile.log' redirects standard output from the
process to your log file. The '2>&1' following that redirects the
process's standard error to its standard output (which means that
error messages will also be written to the log file), and the final
ampersand puts the child process into the background.

The same technique also works with exec() etc.


Torben

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



[PHP] running python in php timeout

2008-12-29 Thread brad

Hi,

I'm executing a python script from php that runs quite a long time (15+ 
minutes) and ends up timing out. Is there a way I can execute the python 
code and move on executing the remaining php code on the page?

Thanks!

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



Re: [PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-02-04 Thread szalinski

Well thanks again,

but I already know what the problem is, it is the response headers being  
added to the ouput file. I just tried with a different code and it seems  
to output the file ok, so i must be going wrong somewhere in the order in  
which i output headers and so on.


i'm gonna keep working on it, i think i have to start from scratch though  
to see where i made the mistake exactly.


:)

On Mon, 04 Feb 2008 21:13:42 -, Richard Lynch <[EMAIL PROTECTED]> wrote:


On Fri, February 1, 2008 7:45 pm, szalinski wrote:

On Thu, 31 Jan 2008 07:13:55 -, Per Jessen <[EMAIL PROTECTED]>
wrote:
Well I got it to work, much thanks to Richard Lynch, but now everytime
I
download a file, it is corrupt. For example, when I download small
.rar
file, just to test, it is always corrupt ('Unexpected end of
archive'). I
also cleared my browser cache just to be sure, but same problem.

Here is the code as it stands. I just can't get my head around why it
wouldn't be working as it is...


Open the file you download with a text or hex editor.

Compare to the original.

If you can't spot the problem right off, download the original with
FTP and use "diff" to compare the two.

Or, if you don't have "diff", upload the broken download with FTP and
use "diff" on the server.

If it's OK on the server, and not coming out OK in the download,
figure out what's different between the two.



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



Re: [PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-02-04 Thread Richard Lynch
On Fri, February 1, 2008 7:45 pm, szalinski wrote:
> On Thu, 31 Jan 2008 07:13:55 -, Per Jessen <[EMAIL PROTECTED]>
> wrote:
> Well I got it to work, much thanks to Richard Lynch, but now everytime
> I
> download a file, it is corrupt. For example, when I download small
> .rar
> file, just to test, it is always corrupt ('Unexpected end of
> archive'). I
> also cleared my browser cache just to be sure, but same problem.
>
> Here is the code as it stands. I just can't get my head around why it
> wouldn't be working as it is...

Open the file you download with a text or hex editor.

Compare to the original.

If you can't spot the problem right off, download the original with
FTP and use "diff" to compare the two.

Or, if you don't have "diff", upload the broken download with FTP and
use "diff" on the server.

If it's OK on the server, and not coming out OK in the download,
figure out what's different between the two.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-02-03 Thread szalinski

Thanks

I have already another post dealing with this issue. (check newsgroup for  
Server to client file transfer always corrupt).


I had figured out the problem that was corrupting the file, it is the  
response headers that are being added to the file when it is downloaded,  
and i don't know how to trim them. I am using a different trim method i  
'borrowed' from another script (where it seems to work perfectly!), and I  
just can't understand why it won't work for me, unless as u say, there are  
other errors being output, but I have looked at the text file and I don't  
see anything other than the headers there. When I use the trim script to  
remove them, it also seems to remove part of the start and end of the text  
file.


I think the most annoying aspect of whole thing is why it is so difficult  
to find a solution to this problem, i'm sure other people must have come  
across this problem?


thanks again :)

On Sun, 03 Feb 2008 16:28:34 -, Richard Lynch <[EMAIL PROTECTED]> wrote:


You can use filesize() to get the file size...
http://php.net/filesize

If that's not going to work because you are stripping out part of the
file, or something, Use fgets to get the header info, and then use
fseek to reset the file pointer to the beginning:
http://php.net/fseek


You can then read as much or as little as you like with fread.

As far as the corrupt files go, compare what you got with the download
and the original in a text editor or a hex editor to see what
happened.

You might have some PHP warnings or notices at the front of the file,
or at the end, messing the file contents up.

On Thu, January 31, 2008 12:11 pm, szalinski wrote:

On Thu, 31 Jan 2008 00:02:55 -, Richard Lynch <[EMAIL PROTECTED]>
wrote:






Hello Richard

Well, thank you for pointing that out to me! I was actually trying to
read
it into RAM, but that was a silly mistake.

But now I have the problem that, even though you are correct, the
problem
seems to still remain, in the sense that I actually *need* to read the
start of the file just to get the header info (so i can retrieve the
Content-Length, and the filename).
Since I tried your method above, I thought I had got the script to
finally
work - which it seemed to - but every file I download with it is
corrupt.
I tried downloading a WinRAR file, and I get 'unexpected end of
archive'.
:( I know for a fact that the archive itself is NOT corrupt, because I
tried it with various different files and all of them ended up
corrupt!

I found some info on the net about fread() and fgets(), and it seems
that
fgets() only reads one line of data up to 1024 bytes, or in my case,
64
bytes. This is what I want to happen, because I need the 'reading' to
abort/break when I have read the required info from the header...I
wish
(and hope!) there was an easier way to get this info other than
searching
for it. :|

Now I am truly vexed because the files are all corrupt when
downloaded,
because I can't see anything wrong with the code. I have added a few
comments, so you can see what I think is the problematic area.

By the way, many thanks for your enthusiastic help so far! - I hope
you
don't take this email to mean I will be mailing you frequently,
believe me
I know you must be busy, and I only mailed you as a last resort!

Thanks again!

0)
{
$url = @parse_url($link);
$fp = @fsockopen($url['host'], 80, $errno, $errstr);
if (!$fp)
 {
 $errormsg = "Error: $errstr, please try again
later.";
 echo $errormsg;
 exit;
 }

$vars = 
"dl.start=PREMIUM&uri={$url['path']}&directstart=1";
$out = "POST {$url['path']} HTTP/1.1\r\n";
$out .= "Host: {$url['host']}\r\n";
$out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; 
Windows NT
5.1)\r\n";
$out .= "Authorization: Basic
".base64_encode("{$rslogin}:{$rspass}")."\r\n";
$out .= "Content-Type: 
application/x-www-form-urlencoded\r\n";
$out .= "Content-Length: ".strlen($vars)."\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
fwrite($fp, $out.$vars);
unset($string);
while (!feof($fp))
{
$string.= fgets($fp, 64);
}
 //Tell us what data is returned
 //print($string);
@fclose($fp);

if (stristr($string, "Location:"))
{
$redirect = trim(cut_str($string, "Location:", 
"\n"));
$full_link = $redirect;
}

//print($string);
//print("".$full_link."");



if ($full_link)

{

//  Get info about the file 

Re: [PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-02-01 Thread Casey

On Feb 1, 2008, at 5:45 PM, szalinski <[EMAIL PROTECTED]> wrote:

On Thu, 31 Jan 2008 07:13:55 -, Per Jessen <[EMAIL PROTECTED]>  
wrote:



Richard Lynch wrote:

Your script is reading the whole file, 64 measly bytes at a time,  
into

a monstrous string $tmp.

Then, finally, when you've loaded the whole [bleep] file into RAM in
$tmp, you just echo it out, right?

Don't do that.

:-)

while (!feof($fp)){
 echo fread($fp, 2048);
}



And if the OP is opening the file anyway, he might as well use
readfile() instead.


/Per Jessen, Zürich


Well I got it to work, much thanks to Richard Lynch, but now  
everytime I download a file, it is corrupt. For example, when I  
download small .rar file, just to test, it is always corrupt  
('Unexpected end of archive'). I also cleared my browser cache just  
to be sure, but same problem.


Here is the code as it stands. I just can't get my head around why  
it wouldn't be working as it is...


// Get the full premium link, and store it in $full_link after the  
redirect. *Surely* there is an easier way to get redirections?


if(strlen($link)>0)
{
   $url = @parse_url($link);
   $fp = @fsockopen($url['host'], 80, $errno, $errstr);
   if (!$fp)
   {
   $errormsg = "Error: $errstr, please try again  
later.";

   echo $errormsg;
   exit;
   }

   $vars = "dl.start=PREMIUM&uri={$url['path']} 
&directstart=1";

   $out = "POST {$url['path']} HTTP/1.1\r\n";
   $out .= "Host: {$url['host']}\r\n";
   $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0;  
Windows NT 5.1)\r\n";
   $out .= "Authorization: Basic ".base64_encode("{$rslogin}: 
{$rspass}")."\r\n";
   $out .= "Content-Type: application/x-www-form-urlencoded\r 
\n";

   $out .= "Content-Length: ".strlen($vars)."\r\n";
   $out .= "Connection: Close\r\n\r\n";
   fwrite($fp, $out);
   fwrite($fp, $out.$vars);
   while (!feof($fp))
   {
   $string .= fgets($fp, 256);
   }
//Tell us what data is returned
//print($string);
   @fclose($fp);

   if (stristr($string, "Location:"))
   {
   $redirect = trim(cut_str($string, "Location:", "\n"));
   $full_link = addslashes(trim($redirect));
   }

//print($string);
//print("".$full_link."");



if ($full_link)

   {

   //Get info about the file we want to download:

   $furl = parse_url($full_link);
   $fvars = "dl.start=PREMIUM&uri={$furl['path']}&directstart=1";
   $head = "Host: {$furl['host']}\r\n";
   $head .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0;  
Windows NT 5.1)\r\n";
   $head .= "Authorization: Basic ".base64_encode("{$rslogin}: 
{$rspass}")."\r\n";

   $head .= "Content-Type: application/x-www-form-urlencoded\r\n";
   $head .= "Content-Length: ".strlen($fvars)."\r\n";
   $head .= "Connection: close\r\n\r\n";
   $fp = @fsockopen($furl['host'], 80, $errno, $errstr);
   if (!$fp)
   {
   echo "The script says $errstr, please try again  
later.";

   exit;
   }
   fwrite($fp, "POST {$furl['path']}  HTTP/1.1\r\n");
   fwrite($fp, $head.$fvars);
   while (!feof($fp))
   {
   //Keep reading the info until we get the filename and  
size from the returned Header - is there no easy way
   //of doing this? I also don't like the way I have to  
'find' the redirected link (above).??

   $tmp .= fgets($fp, 256);
   $d = explode("\r\n\r\n", $tmp);

   // I tried changing this to if ($d), { etc..,  (instead  
of $d[1]) and the download of the rar file *wasn't* corrupt, it just  
had a filetype of x-rar-compressed instead of
   //application/octet-stream, and the filesize was  
'unknown' - now this is just confusing me...!  So i think (and  
guess) the problem of the file corruption is here,
   //because it must add some data to the filestream which  
corrupts it. Darn.

   if($d[1])
   {
   preg_match("#filename=(.+?)\n#", $tmp, $fname);
   preg_match("#Content-Length: (.+?)\n#", $tmp, $fsize);
   $h['filename'] = $fname[1] != "" ? $fname[1] :  
basename($furl['path']);

   $h['fsize'] = $fsize[1];
   break;
   }

}
   @fclose($fp);

   $filename = $h['filename'];
   $fsize = $h['fsize'];

//Now automatically download the file:

   @header("Cache-Control:");
   @header("Cache-Control: public");
   @header("Content-Type: application/octet-stream");
   @header("Content-Disposition: attachment; filename=". 
$filename);

   @header("Accept-Ranges: bytes");
   if(isset($_SERVER['HTTP_RANGE']))
   {
   list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']);
   $range = str_replace("-", "", $range);
   $new_length = $fsize - $range;
   @header("HTTP/1.1 206 Partial Con

Re: [PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-02-01 Thread szalinski

On Thu, 31 Jan 2008 07:13:55 -, Per Jessen <[EMAIL PROTECTED]> wrote:


Richard Lynch wrote:


Your script is reading the whole file, 64 measly bytes at a time, into
a monstrous string $tmp.

Then, finally, when you've loaded the whole [bleep] file into RAM in
$tmp, you just echo it out, right?

Don't do that.

:-)

while (!feof($fp)){
  echo fread($fp, 2048);
}



And if the OP is opening the file anyway, he might as well use
readfile() instead.


/Per Jessen, Zürich


Well I got it to work, much thanks to Richard Lynch, but now everytime I  
download a file, it is corrupt. For example, when I download small .rar  
file, just to test, it is always corrupt ('Unexpected end of archive'). I  
also cleared my browser cache just to be sure, but same problem.


Here is the code as it stands. I just can't get my head around why it  
wouldn't be working as it is...


// Get the full premium link, and store it in $full_link after the  
redirect. *Surely* there is an easier way to get redirections?


if(strlen($link)>0)
{
$url = @parse_url($link);
$fp = @fsockopen($url['host'], 80, $errno, $errstr);
if (!$fp)
{
$errormsg = "Error: $errstr, please try again later.";
echo $errormsg;
exit;
}

$vars = 
"dl.start=PREMIUM&uri={$url['path']}&directstart=1";
$out = "POST {$url['path']} HTTP/1.1\r\n";
$out .= "Host: {$url['host']}\r\n";
			$out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT  
5.1)\r\n";
			$out .= "Authorization: Basic  
".base64_encode("{$rslogin}:{$rspass}")."\r\n";

$out .= "Content-Type: 
application/x-www-form-urlencoded\r\n";
$out .= "Content-Length: ".strlen($vars)."\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
fwrite($fp, $out.$vars);
while (!feof($fp))
{
$string .= fgets($fp, 256);
}
 //Tell us what data is returned
 //print($string);
@fclose($fp);

if (stristr($string, "Location:"))
{
$redirect = trim(cut_str($string, "Location:", 
"\n"));
$full_link = addslashes(trim($redirect));
}

//print($string);
//print("".$full_link."");



if ($full_link)

{

//  Get info about the file we want to download:

$furl = parse_url($full_link);
$fvars = "dl.start=PREMIUM&uri={$furl['path']}&directstart=1";
$head = "Host: {$furl['host']}\r\n";
$head .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows  
NT 5.1)\r\n";
$head .= "Authorization: Basic  
".base64_encode("{$rslogin}:{$rspass}")."\r\n";

$head .= "Content-Type: application/x-www-form-urlencoded\r\n";
$head .= "Content-Length: ".strlen($fvars)."\r\n";
$head .= "Connection: close\r\n\r\n";
$fp = @fsockopen($furl['host'], 80, $errno, $errstr);
if (!$fp)
{
echo "The script says $errstr, please try again later.";
exit;
}
fwrite($fp, "POST {$furl['path']}  HTTP/1.1\r\n");
fwrite($fp, $head.$fvars);
while (!feof($fp))
{
			//Keep reading the info until we get the filename and size from the  
returned Header - is there no easy way
			//of doing this? I also don't like the way I have to 'find' the  
redirected link (above).??

$tmp .= fgets($fp, 256);
$d = explode("\r\n\r\n", $tmp);

			// I tried changing this to if ($d), { etc..,  (instead of $d[1]) and  
the download of the rar file *wasn't* corrupt, it just had a filetype of  
x-rar-compressed instead of
			//application/octet-stream, and the filesize was 'unknown' - now this  
is just confusing me...!  So i think (and guess) the problem of the file  
corruption is here,
			//because it must add some data to the filestream which corrupts it.  
Darn.

if($d[1])
{
preg_match("#filename=(.+?)\n#", $tmp, $fname);
preg_match("#Content-Length: (.+?)\n#", $tmp, $fsize);
$h['filename'] = $fname[1] != "" ? $fname[1] :  
basename($furl['path']);

$h['fsize'] = $fsize[1];
break;
}

}
@fclose($fp);   

$filename = $h['filename'];
$fsize = $h['fsize'];

//Now automatically download the file:

@header("Cache-Control:");
@header("Cache-Control: public");
@header("Content-Type: application/octet-stream");
@header("Content-Disposition:

Re: [PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-01-30 Thread Per Jessen
Richard Lynch wrote:

> Your script is reading the whole file, 64 measly bytes at a time, into
> a monstrous string $tmp.
> 
> Then, finally, when you've loaded the whole [bleep] file into RAM in
> $tmp, you just echo it out, right?
> 
> Don't do that.
> 
> :-)
> 
> while (!feof($fp)){
>   echo fread($fp, 2048);
> }


And if the OP is opening the file anyway, he might as well use
readfile() instead. 


/Per Jessen, Zürich

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



Re: [PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-01-30 Thread Richard Lynch
On Tue, January 29, 2008 12:45 pm, Barney Tramble wrote:
> I have a script that I am trying to figure out to allow a remote file
> to
> be sent to a client's browser. It works ok for small files, but it
> keeps
> timing out for large files. I don't think it should even take as long
> as
> it does (i.e. about 10seconds) before it pops up a dialog box for me
> to
> download a 700KB file. Any ideas? It times out on a line around which
> reads
>
>   while (!feof($fp))
>   {
>  $tmp .= fread($fp, 64);
>   }

Your script is reading the whole file, 64 measly bytes at a time, into
a monstrous string $tmp.

Then, finally, when you've loaded the whole [bleep] file into RAM in
$tmp, you just echo it out, right?

Don't do that.

:-)

while (!feof($fp)){
  echo fread($fp, 2048);
}

You can play around with 2048 versus 64 versus 100 on your box to
see what's "fastest" but I'll be pretty shocked if 64 bytes is the
best performer...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-01-29 Thread Chris

Barney Tramble wrote:


Hey

I have a script that I am trying to figure out to allow a remote file to 
be sent to a client's browser. It works ok for small files, but it keeps 
timing out for large files. I don't think it should even take as long as 
it does (i.e. about 10seconds) before it pops up a dialog box for me to 
download a 700KB file. Any ideas? It times out on a line around which reads


 while (!feof($fp))
{
$tmp .= fread($fp, 64);
}


Well you're still reading the file (or url or something) at this point. 
Is it the reading of the file or sending it to the browser that fails?


A bit of context might help for this code too. Is this reading a local 
file or url or what?


If it's a local file, use fpassthru (http://php.net/fpassthru) if it's 
not too big. If it is a big file then use your loop but don't store it 
in a $tmp variable, just output it.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] Timeout while waiting for a server->client transfer to start (large files)

2008-01-29 Thread Barney Tramble


Hey

I have a script that I am trying to figure out to allow a remote file to  
be sent to a client's browser. It works ok for small files, but it keeps  
timing out for large files. I don't think it should even take as long as  
it does (i.e. about 10seconds) before it pops up a dialog box for me to  
download a 700KB file. Any ideas? It times out on a line around which reads


 while (!feof($fp))
{
$tmp .= fread($fp, 64);
}

Thanks ;)

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



Re: [PHP] Timeout for fopen ?

2007-10-14 Thread Gal
You can use the CURL module, which has support for timeout.
http://www.php.net/manual/en/ref.curl.php

debussy007 wrote:
> Hello,
> 
> I want to use "fopen" to open an URL, but is it possible to add a timeout ? 
> This to avoid that fopen slows down my script ?
> Because if site I access takes 10 secs to respond, 
> I suppose my script will just wait fopen returns something.
> 
> Thank you.

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



Re: [PHP] Timeout for fopen ?

2007-10-13 Thread heavyccasey
You could use Javascript/XMLHTTP to call a PHP script that opens the file.

On 10/13/07, debussy007 <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I want to use "fopen" to open an URL, but is it possible to add a timeout ?
> This to avoid that fopen slows down my script ?
> Because if site I access takes 10 secs to respond,
> I suppose my script will just wait fopen returns something.
>
> Thank you.
> --
> View this message in context: 
> http://www.nabble.com/Timeout-for-fopen---tf4620009.html#a13194530
> Sent from the PHP - General mailing list archive at Nabble.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



[PHP] Timeout for fopen ?

2007-10-13 Thread debussy007

Hello,

I want to use "fopen" to open an URL, but is it possible to add a timeout ? 
This to avoid that fopen slows down my script ?
Because if site I access takes 10 secs to respond, 
I suppose my script will just wait fopen returns something.

Thank you.
-- 
View this message in context: 
http://www.nabble.com/Timeout-for-fopen---tf4620009.html#a13194530
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] PHP timeout

2004-02-03 Thread Mario
Hi all

just a note that the problem was with the php 4.3.2 version finally and
nothing to do with permissions.

So if anyonwe has a similar problem, install a different version (the 4.3.4
is working fine here)

Mario
- Original Message - 
From: "Mario" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 30, 2004 3:28 PM
Subject: Re: [PHP] PHP timeout


> it looks like it has nothing to do with MySQL and just with php
>
> I'm running a simple script like
> $x=23;
>
> echo $x;
>
> and it displays the number 23 properly, but the page keeps loading like
> there is something else to load too.
>
> - Original Message - 
> From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
> To: "Mario" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Friday, January 30, 2004 1:33 PM
> Subject: Re: [PHP] PHP timeout
>
>
> > Hi,
> >
> > Make sure the mysql service is started and make sure that there isn't
> > anything else competing for the same port (3306) beyond that i am afraid
> > i cannot help as i am not  a windows expert.
> >
> >
> > Mario wrote:
> >
> > >both php and mysql is on the same machine.
> > >
> > >even running the following timesout:
> > > > >
> > >if (!($mylink = @mysql_pconnect("localhost","*","**")))
> > >
> > >print "Problem connecting to the database server\n";
> > >
> > >exit();
> > >
> > >}
> > >
> > >mysql_select_db("xxx") or die ("Problem connecting to the
> > >databaseDescription:" . mysql_error());
> > >
> > >?>
> > >
> > >
> > >
> > >
> > >
> > --
> > Raditha Dissanayake.
> > 
> > http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> > Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> > Graphical User Inteface. Just 150 KB | with progress bar.
> >
> > -- 
> > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP timeout

2004-01-30 Thread Mario
it looks like it has nothing to do with MySQL and just with php

I'm running a simple script like
$x=23;

echo $x;

and it displays the number 23 properly, but the page keeps loading like
there is something else to load too.

- Original Message - 
From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
To: "Mario" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, January 30, 2004 1:33 PM
Subject: Re: [PHP] PHP timeout


> Hi,
>
> Make sure the mysql service is started and make sure that there isn't
> anything else competing for the same port (3306) beyond that i am afraid
> i cannot help as i am not  a windows expert.
>
>
> Mario wrote:
>
> >both php and mysql is on the same machine.
> >
> >even running the following timesout:
> > >
> >if (!($mylink = @mysql_pconnect("localhost","*","**")))
> >
> >print "Problem connecting to the database server\n";
> >
> >exit();
> >
> >}
> >
> >mysql_select_db("xxx") or die ("Problem connecting to the
> >databaseDescription:" . mysql_error());
> >
> >?>
> >
> >
> >
> >
> >
> --
> Raditha Dissanayake.
> 
> http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB | with progress bar.
>
> -- 
> 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] PHP timeout

2004-01-30 Thread Raditha Dissanayake
Hi,

Make sure the mysql service is started and make sure that there isn't 
anything else competing for the same port (3306) beyond that i am afraid 
i cannot help as i am not  a windows expert.

Mario wrote:

both php and mysql is on the same machine.

even running the following timesout:

if (!($mylink = @mysql_pconnect("localhost","*","**")))

print "Problem connecting to the database server\n";

exit();

}

mysql_select_db("xxx") or die ("Problem connecting to the
databaseDescription:" . mysql_error());
?>



 

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP timeout

2004-01-30 Thread Mario
both php and mysql is on the same machine.

even running the following timesout:
Problem connecting to the database server\n";

exit();

}

mysql_select_db("xxx") or die ("Problem connecting to the
databaseDescription:" . mysql_error());

?>



- Original Message - 
From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
To: "Mario" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 30, 2004 1:01 PM
Subject: Re: [PHP] PHP timeout


>
> Well the situation you have described are the typical symptoms of a
> firewall eating up packets.  (Simple scripts running fine and those that
> connect to networking timing out) How about installing both the php
> engine and mysql on the same machine for testing?
>
>
> Mario wrote:
>
> >thanks for the reply Raditha.
> >
> >I don't have a firewall setup on this PC
> >
> >Is there a chance it's a permissions problem?
> >And why do few simple scripts run fine though?
> >
> >Thanks
> >
> >Mario
> >- Original Message - 
> >From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
> >To: "Mario" <[EMAIL PROTECTED]>
> >
> >
>
> -- 
> Raditha Dissanayake.
> 
> http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB | with progress bar.
>
> -- 
> 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] PHP timeout

2004-01-30 Thread Raditha Dissanayake
Well the situation you have described are the typical symptoms of a 
firewall eating up packets.  (Simple scripts running fine and those that 
connect to networking timing out) How about installing both the php 
engine and mysql on the same machine for testing?

Mario wrote:

thanks for the reply Raditha.

I don't have a firewall setup on this PC

Is there a chance it's a permissions problem?
And why do few simple scripts run fine though?
Thanks

Mario
- Original Message - 
From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
To: "Mario" <[EMAIL PROTECTED]>
 

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP timeout

2004-01-30 Thread Mario
thanks for the reply Raditha.

I don't have a firewall setup on this PC

Is there a chance it's a permissions problem?
And why do few simple scripts run fine though?

Thanks

Mario
- Original Message - 
From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
To: "Mario" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 30, 2004 12:14 PM
Subject: Re: [PHP] PHP timeout


> Mario,
>
> Please don't reply to a message when you want to ask a question compose
> a new thread instead.
>
> Anyway from what you have described it sounds like you have a firewall
> that's blocking the mysql port. Somefirewalls just drop the packets
> instead of denying the connection. That way the script just hangs an
> eternit waiting for a packet that never arrives. Try stopping your
> firewall completely .
>
>
>
>
> Mario wrote:
>
> >Hi all
> >
> >I have a winXP machine on a network running IIS (PHP and MySQL is
installed)
> >
> >I have recently moved from one machine to another and after setting up
IIS
> >and the rest and try to run few PHP scripts they just run forever or
> >timeout. I believe the problem is with the security permission on ...
> >somewhere, since I've been doing the same setup in several machines and
it
> >works fine (not in this network).
> >
> >Now, the funny thing is that most simple php script run fast after
playing
> >with the permissions but more complicating scripts or the phpMyAdmin just
> >timesout.
> >
> >Does anyone know what the hell is going on?
> >
> >Mario
> >
> >
> >
>
>
> -- 
> Raditha Dissanayake.
> 
> http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB | with progress bar.
>
> -- 
> 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] PHP timeout

2004-01-30 Thread Raditha Dissanayake
Mario,

Please don't reply to a message when you want to ask a question compose 
a new thread instead.

Anyway from what you have described it sounds like you have a firewall 
that's blocking the mysql port. Somefirewalls just drop the packets 
instead of denying the connection. That way the script just hangs an 
eternit waiting for a packet that never arrives. Try stopping your 
firewall completely .



Mario wrote:

Hi all

I have a winXP machine on a network running IIS (PHP and MySQL is installed)

I have recently moved from one machine to another and after setting up IIS
and the rest and try to run few PHP scripts they just run forever or
timeout. I believe the problem is with the security permission on ...
somewhere, since I've been doing the same setup in several machines and it
works fine (not in this network).
Now, the funny thing is that most simple php script run fast after playing
with the permissions but more complicating scripts or the phpMyAdmin just
timesout.
Does anyone know what the hell is going on?

Mario

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP timeout

2004-01-30 Thread Mario
Hi all

I have a winXP machine on a network running IIS (PHP and MySQL is installed)

I have recently moved from one machine to another and after setting up IIS
and the rest and try to run few PHP scripts they just run forever or
timeout. I believe the problem is with the security permission on ...
somewhere, since I've been doing the same setup in several machines and it
works fine (not in this network).

Now, the funny thing is that most simple php script run fast after playing
with the permissions but more complicating scripts or the phpMyAdmin just
timesout.

Does anyone know what the hell is going on?

Mario

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



Re: [PHP] timeout question

2003-10-06 Thread Curt Zirzow
* Thus wrote David Coleman ([EMAIL PROTECTED]):
> I have a PHP page that for some reason is taking an ungodly long time to
> execute.  I suspect that this is simply b/c I’m running Apache 1.3 /
> MySQL 4.013-nt, PHP 4, Zend studio 3.0, and MySQL GUI on a 266 MhZ win2K
> server.  (Yes people, I know I’m choking the poor thing, but I can’t
> afford a new server right now.)
>  
> My question to the group is:
>  
> Does anyone know how I can increase my timeouts on page generation?
> Halfway through the rowset, the page stops generating and returns to the
> browser cut off at whatever point the server (apache, PHP or MySQL, I
> dunno which) gave up and decided the page was taking too long.  It seems
> to be a 90 second html response timeout imbedded somewhere in my
> configuration, but I have no idea where to look to change this value to
> unlimited, or maybe to 600 seconds or something more reasonable for the
> hideous rowsets that my project is dealing with.
SEE:

In your php.ini:
  max_execution_time = 30; ;default value

Apache conf:
  Timeout 300  #default value in seconds
  
  
Curt
-- 
List Stats: http://zirzow.dyndns.org/html/mlists/php_general/

"I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] timeout question

2003-10-06 Thread Vail, Warren
http://www.php.net/manual/en/function.set-time-limit.php

Warren Vail

-Original Message-
From: David Coleman [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 11:47 AM
To: [EMAIL PROTECTED]
Subject: [PHP] timeout question


I have a PHP page that for some reason is taking an ungodly long time to
execute.  I suspect that this is simply b/c I'm running Apache 1.3 /
MySQL 4.013-nt, PHP 4, Zend studio 3.0, and MySQL GUI on a 266 MhZ win2K
server.  (Yes people, I know I'm choking the poor thing, but I can't
afford a new server right now.)
 
My question to the group is:
 
Does anyone know how I can increase my timeouts on page generation?
Halfway through the rowset, the page stops generating and returns to the
browser cut off at whatever point the server (apache, PHP or MySQL, I
dunno which) gave up and decided the page was taking too long.  It seems
to be a 90 second html response timeout imbedded somewhere in my
configuration, but I have no idea where to look to change this value to
unlimited, or maybe to 600 seconds or something more reasonable for the
hideous rowsets that my project is dealing with.
 
I don't know if this is a PHP question, but I'm trying PHP, Apache, and
MySQL in case there is a cursor timeout or something...
 
Anyone feel like sharing some nifty tricks to help me tweak my
performance?  I don't care if the page takes 10 hours to generate, I'm
on a local secure network and I want my connections open that long. (I'd
also like to know if there's any tricks to not using cursors and loading
re-usable recordset-style objects into mysql_result variables, so I
don't have to hit the db every time I want to re-use a loaded rowset.
But let's get my pages to finish generating first.
 
:-)
 
Thanks a bunch everyone!
 
Dave Coleman
Software Engineer
TeraByte Software Solutions LLC
[EMAIL PROTECTED]
 

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



[PHP] timeout question

2003-10-06 Thread David Coleman
I have a PHP page that for some reason is taking an ungodly long time to
execute.  I suspect that this is simply b/c I’m running Apache 1.3 /
MySQL 4.013-nt, PHP 4, Zend studio 3.0, and MySQL GUI on a 266 MhZ win2K
server.  (Yes people, I know I’m choking the poor thing, but I can’t
afford a new server right now.)
 
My question to the group is:
 
Does anyone know how I can increase my timeouts on page generation?
Halfway through the rowset, the page stops generating and returns to the
browser cut off at whatever point the server (apache, PHP or MySQL, I
dunno which) gave up and decided the page was taking too long.  It seems
to be a 90 second html response timeout imbedded somewhere in my
configuration, but I have no idea where to look to change this value to
unlimited, or maybe to 600 seconds or something more reasonable for the
hideous rowsets that my project is dealing with.
 
I don’t know if this is a PHP question, but I’m trying PHP, Apache, and
MySQL in case there is a cursor timeout or something…
 
Anyone feel like sharing some nifty tricks to help me tweak my
performance?  I don’t care if the page takes 10 hours to generate, I’m
on a local secure network and I want my connections open that long. (I’d
also like to know if there’s any tricks to not using cursors and loading
re-usable recordset-style objects into mysql_result variables, so I
don’t have to hit the db every time I want to re-use a loaded rowset.
But let’s get my pages to finish generating first.
 
:-)
 
Thanks a bunch everyone!
 
Dave Coleman
Software Engineer
TeraByte Software Solutions LLC
[EMAIL PROTECTED]
 


[PHP] Timeout and fsockopen

2003-09-16 Thread uros . gruber
Hello!

I'm trying to find if some host is up or not.

For example

$fp = @fsockopen ('www.damirjosar.com', 80, $errno, $errstr, 1);

because this url is expired it takes about 10 seconds to get response from
DNS, but with fsockopne it take 62 seconds. but i set timeout to 1.

I also try checkdnsrr and gethostbyname and all functions takes about 60
seconds. Why?. Can this be set to lover value.

I was looking in source code, but I'm not good at C, so I can't figure out
what the problem is.
  
I'm doing some link checker and when i get to host like this everything
stops and waits


-- 
Best regards,
 uros

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



Re: [PHP] REVISED: PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Curt Zirzow
Ok, I've got it working now, it looks like you have to make your
script more complient to HTTP specs, it seems this server is very
picky on how you read the data. which is very odd..

got it working at:
http://zirzow.dyndns.org/php/fread/timeout.php

funny though you should be able to do a straight fread on it.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] REVISED: PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Curt Zirzow
* Thus wrote Robert Fitzpatrick ([EMAIL PROTECTED]):
> >
> > I tested it here:
> > http://zirzow.dyndns.org/php/fread/timeout.php
> >
> 
> Thanks, I took your source and pasted it in my debugger and ran it fine like
> on your server. I narrowed down the, evidently significant, difference. Your
> content is has  line endings, hence, the 'Missing query parameters:
> xml' response. If I change those line endings to just  or put it all on
> one continuous line, I get the long delay again.

yeah my mistake, fixed that and now it doesn't work like yours. grrr..

> 
> Any thoughts I what would cause this?
hm.. i changed my fread to read 1 byte at a time and I end up with:

HTTP/1.1 2


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] REVISED: PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Robert Fitzpatrick
>
> I tested it here:
> http://zirzow.dyndns.org/php/fread/timeout.php
>

Thanks, I took your source and pasted it in my debugger and ran it fine like
on your server. I narrowed down the, evidently significant, difference. Your
content is has  line endings, hence, the 'Missing query parameters:
xml' response. If I change those line endings to just  or put it all on
one continuous line, I get the long delay again.

Any thoughts I what would cause this?

--
Robert



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



Re: [PHP] REVISED: PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Robert Fitzpatrick

> Try not having the connection kept alive. (just a thought)
>

Same long reponse :(



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



Re: [PHP] REVISED: PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Curt Zirzow
* Thus wrote Robert Fitzpatrick ([EMAIL PROTECTED]):
> Sorry, the correct request and response is below, the one I copied before
> was from the browser:

I tested it here:
http://zirzow.dyndns.org/php/fread/timeout.php

Appears to work ok.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] REVISED: PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Peter Clarke
Robert Fitzpatrick wrote:

Sorry, the correct request and response is below, the one I copied before
was from the browser:
Request:
Request:POST /XMLCommunicationServlet HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: PHP XMLRPC
Host: api.newedgenetworks.com:80
Connection: keep-alive
Try not having the connection kept alive. (just a thought)

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


Re: [PHP] REVISED: PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Robert Fitzpatrick
Sorry, the correct request and response is below, the one I copied before
was from the browser:

Request:
Request:POST /XMLCommunicationServlet HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: PHP XMLRPC
Host: api.newedgenetworks.com:80
Connection: keep-alive
Content-Length: 758

txnType=P&partner=&xml=%3C%3Fxml+version%3D%221.0%22%3F%3E%3C%21DOCTYPE+preq
ualrequest+SYSTEM+%22http%3A%2F%2Fapi.newedgenetworks.com%3A80%2Fdtd%2Fprequ
alrequest.dtd%22%3E%3CPrequalRequest%3E%3CIdentification%3E%3CUs
er%3E4036632%3C%2FUser%3E%3CPassword%3ELnKB8b%3C%2FPassword%3E%3
C%2FIdentification%3E%3CServiceType%3ER%3C%2FServiceType%3E%3CAddres
s%3E+++%3CStreet1%3E2780+CEDARLINKS+DRIVE%3C%2FStreet1%3E+++%3CCity%
3EMEDFORD%3C%2FCity%3E+++%3CState%3EOR%3C%2FState%3E+++%3CZipCD%3E97
504%3C%2FZipCD%3E%3C%2FAddress%3E%3CPhone%3E%3CPhoneNPA%3E54
1%3C%2FPhoneNPA%3E%3CPhoneNXX%3E772%3C%2FPhoneNXX%3E%3CPhone
Suffix%3E6990%3C%2FPhoneSuffix%3E%3C%2FPhone%3E%3C%2FPrequalRequest%3E

Response:
HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 343
Date: Thu, 24 Jul 2003 15:18:52 GMT
Server: Apache Coyote/1.0
Connection: Keep-Alive


http://api.newedgenetworks.com/dtd/prequalresponse.dtd";>

 1050Prequalification failed:
AggregateCircuit unavailable




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



Re: [PHP] PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Robert Fitzpatrick
> > if (!fputs($fp, $op, strlen($op))) {
>
> which HTTP version are you requesting? I know that if you send a
> HTTP/1.1 then a lot of servers send the data in chunks, thus your
> retrieval code needs to be different. If it is HTTP/1.1 try using
> HTTP/1.0 instead.
>
Same difference with the 1.0, I was using 1.1, here is the complete request
and response. The response comes back as 1.1 regardless of what I use (of
course, the xml parameter is urlencoded):

Request:
POST /XMLCommunicationServlet HTTP/1.0 Content-Type:
application/x-www-form-urlencoded User-Agent: PHP XMLRPC Host:
api.newedgenetworks.com:80 Connection: keep-alive Content-Length: 758
txnType=P&partner=&xml=%3C%3Fxml+version%3D%221.0%22%3F%3E%3C%21DOCTYPE+preq
ualrequest+SYSTEM+%22http%3A%2F%2Fapi.newedgenetworks.com%3A80%2Fdtd%2Fprequ
alrequest.dtd%22%3E%3CPrequalRequest%3E%3CIdentification%3E%3CUs
er%3Eusername%3C%2FUser%3E%3CPassword%3mypassword%3C%2FPassword%3E++
++%3C%2FIdentification%3E%3CServiceType%3ER%3C%2FServiceType%3E%3CAd
dress%3E+++%3CStreet1%3E2780+CEDARLINKS+DRIVE%3C%2FStreet1%3E+++%3CC
ity%3EMEDFORD%3C%2FCity%3E+++%3CState%3EOR%3C%2FState%3E+++%3CZipCD%
3E97504%3C%2FZipCD%3E%3C%2FAddress%3E%3CPhone%3E%3CPhoneNPA%
3E541%3C%2FPhoneNPA%3E%3CPhoneNXX%3E772%3C%2FPhoneNXX%3E%3CP
honeSuffix%3E6990%3C%2FPhoneSuffix%3E%3C%2FPhone%3E%3C%2FPrequalRequest%
3E

Response:
HTTP/1.1 200 OK Content-Type: text/xml Content-Length: 343 Date: Thu, 24 Jul
2003 15:18:52 GMT Server: Apache Coyote/1.0 Connection: Keep-Alive
1050Prequalification failed: AggregateCircuit unavailable

> > $ipd = "";
> > while($data=fread($fp, 32768)) {
>
> Have you tried smaller requests mabey 512? although that shouldn't
> matter, but you might be able to see if it is getting data back at
> all.
>
Yes, I've tried 128 and get the same delay.

Thanks for any help:)
--
Robert



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



Re: [PHP] PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Curt Zirzow
* Thus wrote Robert Fitzpatrick ([EMAIL PROTECTED]):
> I am trying to communicate with an API of a vendors of ours. They provide a
> Perl example that works fast and well. I am trying to do the same thing with
> a PHP class. The response takes over a minute before the response comes
> back. I see from the response text that the API is running on Apache
> Coyote/1.0. Does anyone know of issues with this match-up, here is the
> snippet of code that seems to be hanging. Using my Komodo debugger, it
> points to the line with 'while($data=fread($fp, 32768))' while waiting for
> execution to continue. Using a Perl script provided by them, I get a
> response in seconds. Basically, my PHP page prepares content and variables
> and then uses this class to send XML formatted content to receive a
> response.
> 
>   ...
>   $fp=fsockopen($this->server, $this->port, &$this->errno,
> &$this->errstr, $this->timeout);
> 
>   if(!$fp) {
> $this->errstr="Cant Connect to Service ($this->server:$this->port,
> $this->errno, $this->errstr)";
> return;
>   }
> 
>   if (!fputs($fp, $op, strlen($op))) {

which HTTP version are you requesting?  I know that if you send a
HTTP/1.1 then a lot of servers send the data in chunks, thus your
retrieval code needs to be different. If it is HTTP/1.1 try using
HTTP/1.0 instead.


>   $this->errstr="Write error";
>   return;
>   } else {
> 
>$ipd = "";
>while($data=fread($fp, 32768)) {

Have you tried smaller requests mabey 512? although that shouldn't
matter, but you might be able to see if it is getting data back at
all.

>   $ipd.=$data;
>}

HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Robert Fitzpatrick
I am trying to communicate with an API of a vendors of ours. They provide a
Perl example that works fast and well. I am trying to do the same thing with
a PHP class. The response takes over a minute before the response comes
back. I see from the response text that the API is running on Apache
Coyote/1.0. Does anyone know of issues with this match-up, here is the
snippet of code that seems to be hanging. Using my Komodo debugger, it
points to the line with 'while($data=fread($fp, 32768))' while waiting for
execution to continue. Using a Perl script provided by them, I get a
response in seconds. Basically, my PHP page prepares content and variables
and then uses this class to send XML formatted content to receive a
response.

  ...
  $fp=fsockopen($this->server, $this->port, &$this->errno,
&$this->errstr, $this->timeout);

  if(!$fp) {
$this->errstr="Cant Connect to Service ($this->server:$this->port,
$this->errno, $this->errstr)";
return;
  }

  if (!fputs($fp, $op, strlen($op))) {
  $this->errstr="Write error";
  return;
  } else {

   $ipd = "";
   while($data=fread($fp, 32768)) {
  $ipd.=$data;
   }
$this->responsetext = $ipd;
//echo "".$ipd."";
 $ipd = $this->_parse_header($ipd);

  }

  fclose($fp);
  return $ipd;
  ...



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



Re: [PHP] Timeout during SMTP operation.

2003-01-02 Thread Michael J. Pawlowsky


Am I happy I'm not your hosting provider!  :-)
They will probably flip if they see you send out 7000 e-mails.

Anyways  crontab -e from a shell allows you to create a cronjob.

from a shell just "man crontab"

Cheers,
Mike




*** REPLY SEPARATOR  ***

On 02/01/2003 at 4:39 PM gilrain wrote:

>I do know that my host allows me to use
>crontab, though, and most other common *nix programs.
>
>Could you (or any of the other readers) explain how I would go about using
>cron or at to do what my function is trying to do?
>
>



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




Re: [PHP] Timeout during SMTP operation.

2003-01-02 Thread gilrain
Okay, that does sound more efficient. I'd love to give this a try, but to be
completely honest I haven't done much from the shell other than basic
commands and managing MySQL. I do know that my host allows me to use
crontab, though, and most other common *nix programs.

Could you (or any of the other readers) explain how I would go about using
cron or at to do what my function is trying to do?


"Chris Hewitt" wrote:
> It may well be a DNS problem. If an email address resolves in DNS
> immediately then an email may be sent very quickly. If not, DNS timeout
> can be in minutes. You could try using the dig program to look for MX or
> A records for your email addresses.
>
> If you have a lot of customised emails to send then trying to do them on
> a web page is not such a good idea. I suggest doing them via a cron/at
> job, where there will be no timeout.
>
> Regards
> Chris



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




Re: [PHP] Timeout during SMTP operation.

2003-01-02 Thread Chris Hewitt
gilrain wrote:


Hi all,

I've just finished a PHP/MySQL mailing list. Basically, I'm having problems
with my sendmail function. It takes an array of e-mail addresses
($addresses) and loops through it, e-mailing each one using an SMTP class I
found (the only identifying comment in it is "SMTP Class By TOMO
(2001/09/14)"). The problem is, it's very slow. The typical array of
addresses sent to this is 100 to 500 elements large. The actual mailing list
has over 7000 members, but the e-mails are sent out to a geographical
region. Ideally, though, this function should be able to handle mailing to
the entire member base.


It may well be a DNS problem. If an email address resolves in DNS 
immediately then an email may be sent very quickly. If not, DNS timeout 
can be in minutes. You could try using the dig program to look for MX or 
A records for your email addresses.

If you have a lot of customised emails to send then trying to do them on 
a web page is not such a good idea. I suggest doing them via a cron/at 
job, where there will be no timeout.

Regards
Chris



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



[PHP] Timeout during SMTP operation.

2003-01-02 Thread gilrain
Hi all,

I've just finished a PHP/MySQL mailing list. Basically, I'm having problems
with my sendmail function. It takes an array of e-mail addresses
($addresses) and loops through it, e-mailing each one using an SMTP class I
found (the only identifying comment in it is "SMTP Class By TOMO
(2001/09/14)"). The problem is, it's very slow. The typical array of
addresses sent to this is 100 to 500 elements large. The actual mailing list
has over 7000 members, but the e-mails are sent out to a geographical
region. Ideally, though, this function should be able to handle mailing to
the entire member base.

Here's the offending function (with private stuff altered). Currently, it
will only send to about 50 of the addresses before Internet Explorer times
out and cuts it off (perhaps five minutes or so). Note that this is without
catches, so it skips to the 'else'.

If I comment out the sending part, as shown, the operation takes a split
second and the log is written correctly, so I know the problem lies in the
sending of the mail. The only solution I can think of is to make the user
send things in chunks of 50 or so addresses, but I'd like to avoid this
inconvenience if I can. Any ideas?

// Sends e-mail to the specified list of member e-mail addresses.
function ncSendMail($addresses, $subject, $body)
{
   // Delete last log file.
   $ftp = ftp_connect("ftp.somewhere.net");
   ftp_login($ftp, "someone", "something");
   ftp_delete($ftp, "/sendlog.txt");
   ftp_quit($ftp);

   // Create new log file.
   $sendlog = fopen("ftp://someone:[EMAIL PROTECTED]/sendlog.txt";,
"w");
   fwrite($sendlog, "Last Mailing Result\r\n");
   fwrite($sendlog, "Generated: ".date("m-d-Y, h:i:sa")."\r\n\r\n");
   fwrite($sendlog, "The e-mail attempted is reproduced below.\r\n");
   fwrite($sendlog, "Subject: ".$subject."\r\n");
   fwrite($sendlog, $body."\r\n\r\n\r\n");

   // Get the automail 'footer' from the 'automail' table and append it to
the body.
   $body .= ncGetAutomail("footer");

   // If there are catches, then for each member in $addresses, parse the
subject and body for catches and substitute where appropriate.
   if ( is_string(strstr($body, "%FIRSTNAME%")) ||
is_string(strstr($subject, "%FIRSTNAME%")) ||
is_string(strstr($body, "%LASTNAME%")) ||
is_string(strstr($subject, "%LASTNAME%")) ||
is_string(strstr($body, "%EMAIL%")) ||
is_string(strstr($subject, "%EMAIL%")) )
   {
  $mysql = ncConnect();
  fwrite($sendlog, "Beginning to send messages...\r\n\r\n");
  foreach($addresses as $address)
  {
 $this_subject = $subject;
 $this_body = $body;
 $dbresult = mysql_unbuffered_query("SELECT lname, fname FROM
members WHERE email = '$address'");
 $dbrow = mysql_fetch_row($dbresult);
 $this_subject = str_replace("%FIRSTNAME%", $dbrow[1],
$this_subject);
 $this_subject = str_replace("%LASTNAME%", $dbrow[0],
$this_subject);
 $this_subject = str_replace("%EMAIL%", $address, $this_subject);
 $this_body = str_replace("%FIRSTNAME%", $dbrow[1], $this_body);
 $this_body = str_replace("%LASTNAME%", $dbrow[0], $this_body);
 $this_body = str_replace("%EMAIL%", $address, $this_body);

 $smtp = new smtp("smtp.somewhere.com");
 if ($smtp->sendmail($address, "[EMAIL PROTECTED]",
$this_subject, $this_body))
fwrite($sendlog, "Successfully sent to member
\"".$address."\".\r\n");
 else
fwrite($sendlog, "Failed to send to member
\"".$address."\".\r\n");
  }
  fwrite($sendlog, "\r\nFinsihed sending messages.");
  mysql_close($mysql);
   }

   // If there aren't catches, send the plain e-mail.
   else
   {
  fwrite($sendlog, "Beginning to send messages...\r\n\r\n");
  foreach($addresses as $address)
  {
 //$smtp = new smtp("smtp.domain-mail.com");
 //if ($smtp->sendmail($address, "[EMAIL PROTECTED]", $subject,
$body))
fwrite($sendlog, "Successfully sent to member
\"".$address."\".\r\n");
 //else
 //   fwrite($sendlog, "Failed to send to member
\"".$address."\".\r\n");
  }
  fwrite($sendlog, "\r\nFinished sending messages.");
   }

   // Return.
   fclose($sendlog);
   return true;
}



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




Re: [PHP] timeout

2002-10-04 Thread Marek Kilimajer

Is this true? I haven't heard about this. I thought it's the browser 
that closes conection a thus terminates the script, but this can be 
avoided using ignore_user_abort(false);

Rasmus Lerdorf wrote:

>If you set_tiome_limit(0) your script will not be timed out as long as it
>keeps sending something every now and then.  If it just sits there without
>outputting anything, then Apache will kill it off eventually.
>
>On Fri, 4 Oct 2002, lallous wrote:
>
>  
>
>>Hello,
>>
>>
>>if i set set_time_limit(0) will my script still timeout and see in the
>>browser: Page timed out and cannot be displayed?
>>
>>is there is anything I can do to prevent a script that takes an hour to
>>finish processing from being killed when timeout occurs?
>>
>>Thanks,
>>Elias
>>
>>
>>
>>--
>>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] timeout

2002-10-04 Thread lallous

so do you suggest that I send space-characters and then do a flush() ?

Thanks,
Elias

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> If you set_tiome_limit(0) your script will not be timed out as long as it
> keeps sending something every now and then.  If it just sits there without
> outputting anything, then Apache will kill it off eventually.
>
> On Fri, 4 Oct 2002, lallous wrote:
>
> > Hello,
> >
> >
> > if i set set_time_limit(0) will my script still timeout and see in the
> > browser: Page timed out and cannot be displayed?
> >
> > is there is anything I can do to prevent a script that takes an hour to
> > finish processing from being killed when timeout occurs?
> >
> > Thanks,
> > Elias
> >
> >
> >
> > --
> > 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] timeout

2002-10-04 Thread Rasmus Lerdorf

If you set_tiome_limit(0) your script will not be timed out as long as it
keeps sending something every now and then.  If it just sits there without
outputting anything, then Apache will kill it off eventually.

On Fri, 4 Oct 2002, lallous wrote:

> Hello,
>
>
> if i set set_time_limit(0) will my script still timeout and see in the
> browser: Page timed out and cannot be displayed?
>
> is there is anything I can do to prevent a script that takes an hour to
> finish processing from being killed when timeout occurs?
>
> Thanks,
> Elias
>
>
>
> --
> 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] timeout

2002-10-04 Thread lallous

Hello,


if i set set_time_limit(0) will my script still timeout and see in the
browser: Page timed out and cannot be displayed?

is there is anything I can do to prevent a script that takes an hour to
finish processing from being killed when timeout occurs?

Thanks,
Elias



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




Re[4]: [PHP] PHP timeout

2002-06-15 Thread Stuart Dallas

On Saturday, June 15, 2002 at 11:58:44 AM, Kim Bauters wrote:
> My IIS version is 5.0

Hmm, same as mine. Have a look in the master properties of the server. If it's
not there then I suggest you search the MS site for help.

-- 
Stuart


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




Re: Re[2]: [PHP] PHP timeout

2002-06-15 Thread Kim Bauters

hi,
My IIS version is 5.0

"Stuart Dallas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Saturday, June 15, 2002 at 11:43:05 AM, Kim Bauters wrote:
> > indeed, it is a IIS CGI timeout. However, when I take a look at the tab
you
> > gave me, I can only seem to find the tabs called "App Mappings", "App
> > Options" and "App Debugging". Is this the right place and is the tab
just
> > missing or is there a problem on my behalf?
>
> What version of IIS are you running? It may be in a different place on
your
> server.
>
> --
> Stuart
>



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




Re[2]: [PHP] PHP timeout

2002-06-15 Thread Stuart Dallas

On Saturday, June 15, 2002 at 11:43:05 AM, Kim Bauters wrote:
> indeed, it is a IIS CGI timeout. However, when I take a look at the tab you
> gave me, I can only seem to find the tabs called "App Mappings", "App
> Options" and "App Debugging". Is this the right place and is the tab just
> missing or is there a problem on my behalf?

What version of IIS are you running? It may be in a different place on your
server.

-- 
Stuart


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




Re: [PHP] PHP timeout

2002-06-15 Thread Kim Bauters

Hi,
indeed, it is a IIS CGI timeout. However, when I take a look at the tab you
gave me, I can only seem to find the tabs called "App Mappings", "App
Options" and "App Debugging". Is this the right place and is the tab just
missing or is there a problem on my behalf?

thx

"Stuart Dallas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Saturday, June 15, 2002 at 10:52:14 AM, Kim Bauters wrote:
> > In the file php.ini, the 2 timeout settings are
> > both changed from 30 to 300, but I keep on getting an error like "CGI
script
> > Timeout".
>
> I think you'll find that's the IIS CGI timeout, not PHPs. You can find
that
> setting in the site properties, Home Directory tab, click on the
Configuration
> button, then go to the Process Options tab. At the bottom of that tab you
> should have a CGI script timeout value. Try increasing that.
>
> --
> Stuart
>



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




Re: [PHP] PHP timeout

2002-06-15 Thread Stuart Dallas

On Saturday, June 15, 2002 at 10:52:14 AM, Kim Bauters wrote:
> In the file php.ini, the 2 timeout settings are
> both changed from 30 to 300, but I keep on getting an error like "CGI script
> Timeout".

I think you'll find that's the IIS CGI timeout, not PHPs. You can find that
setting in the site properties, Home Directory tab, click on the Configuration
button, then go to the Process Options tab. At the bottom of that tab you
should have a CGI script timeout value. Try increasing that.

-- 
Stuart


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




Re: [PHP] PHP timeout

2002-06-15 Thread Nathan Taylor

Hmm, I haven't heard of such a thing. That's kinda weird though because just yesterday 
I modified my timeout settings for my script that parses logfiles that are several 
thousand lines long, and it worked. Did you perhaps forget to reboot the server? If 
you have my suggestion is perhaps taking a look at FoxServ, it is a very good server 
that auto configures itself on your machine with apache and the whole lot.   
www.foxserv.net   

- Original Message -
From: Kim Bauters
Sent: Saturday, June 15, 2002 5:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP timeout

I'm running PHP script that check for the existance of certain pages on the
web. The problem is that fopen to check for the existance of a page and this
seems to consume time. It has to check for a nuber of pages, conforming to a
certain pattern. This pattern is Ab#

What I want to do is extend the time a script is allowed to run (because I
can only check 10 pages, then need to change the code for the next pages)
but I don't seem to be able to do this. I'm using Windows 2000 and PHP is
installed on my IIS server. In the file php.ini, the 2 timeout settings are
both changed from 30 to 300, but I keep on getting an error like "CGI script
Timeout".

Can anyone help?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.phpGet more from the Web.  FREE MSN 
Explorer download : http://explorer.msn.com



[PHP] PHP timeout

2002-06-15 Thread Kim Bauters

I'm running PHP script that check for the existance of certain pages on the
web. The problem is that fopen to check for the existance of a page and this
seems to consume time. It has to check for a nuber of pages, conforming to a
certain pattern. This pattern is Ab#

What I want to do is extend the time a script is allowed to run (because I
can only check 10 pages, then need to change the code for the next pages)
but I don't seem to be able to do this. I'm using Windows 2000 and PHP is
installed on my IIS server. In the file php.ini, the 2 timeout settings are
both changed from 30 to 300, but I keep on getting an error like "CGI script
Timeout".

Can anyone help?



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




[PHP] Timeout features of PHP

2001-07-20 Thread BlackLord

Hi, instead of max_execution_time, what are the other features of PHP to
time out running PHP script ? For example, does keep-alive feature related
with running of PHP script?

I want to disable all timeout features so that my script will run hours and
hours...

Thanks...




-- 
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]