[PHP] Re: mail() getenv() problems (after 4.1.2 update)...

2002-03-11 Thread Keith Waters

Just to report back to the group, the mail() delay problem was solved by
putting entries into /etc/hosts to speed up reverse DNS lookups.  (Worked
fine before 4.1.2, but I guess there's some new code in there somewhere!)

Paul's getenv() problem was a simple one, he forgot the double-quotes!

Keith

Keith Waters [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm having the same problem -

 I've been using the mail() command for quite some time now and it's been
 working 100% and executing immediately.

 Suddenly, this morning, it is taking about 60 seconds to send mail,
delaying
 the display of the php web page by that same amount of time.

 I have checked the mail server and sending mail from the command prompt
 (linux) and there is no delay there.

 Does anybody have any clue? I even momentarily downgraded to 4.1.0 to make
 sure it wasnt a bug in 4.1.2


 Paul [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Can nobody help?  This is so frustrating.  I cannot see what's wrong,
open
  to ANY suggestions!
 
  Thanks.
 
  Paul
  Paul [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hello,
  
   I wonder if anyone can help me with a problem I have.  I have some
sites
   hosted on a Cobalt Raq4 server (not sure if this is relevant).  I
 recently
   upgraded PHP from a package at www.pkgmaster.com, and since making
this
   upgrade I have problems with PHP that I cannot find the solution to.
  
   I have conacted their 'team' who have thus far offered no explanation,
   saying it must be something else causing these issues with PHP, but I
   haven't made any more changes, just installed the new PHP version.
  
   The problems are with the mail() function taking an AGE to excecute,
and
   environmental HTTP header information not being sent/recieved by
 getenv().
  
   Some examples follow..
  
   For example, as an extremely basic example of the mail function going
  slow,
   this simple script:
   ?
   mail([EMAIL PROTECTED], Test subject, Test
message);
   print finished!;
   ?
  
   Which can be found at http://www.clicktolearn.co.uk/test/mail.php in
  action,
   ran (as it should do) extremely fast the week before I made the
upgrade
  from
   the packages.  Now, as you will see, it runs dog slow.
  
   Secondly, the following script shows the lack of headers:
   http://www.clicktolearn.co.uk/test/  (click the link, so there's a
 referer
   to the script page)...
  
   ?
   function get_http_headers($url, $proto=HTTP/1.0, $timeout=10) {
   $return = false;
   if (substr($url,0,7)==http://;) {
   $url = substr($url,7);
   }
  
   $parts = parse_url(http://.$url);
  
   $ips = gethostbynamel($parts[host]);
  
   if ($ips[0]) {
   $ip = $ips[0];
   $host = $parts[host];
   $path = ($parts[path]) ? $parts[path] : /;
   $port = ($parts[port]) ? $parts[port] : 80;
  
   $start = time();
   $timeout = $timeout + $start;
  
   if($sock = fsockopen($host, $port)) {
   set_socket_blocking($sock, 0);
   switch($proto) {
   case HTTP/1.1:
   set_socket_blocking($sock, 1);
   fputs($sock, sprintf(HEAD %s
  %s\n,
   $path, $proto));
   fputs($sock, sprintf(Host:
  %s\n\n,
   $host));
   break;
   default:
   fputs($sock, sprintf(HEAD %s
   %s\n\n, $path, $proto));
   }
  
   while(!feof($sock)  $t$timeout) {
   $line .= fgets($sock,1);
   $t = time();
   }
   fclose($sock);
   $end = time();
  
   if ($t=$timeout) {
   $http = parse_output($line);
   $http[result] = 502;
   $http[message] = Timed Out;
   $http[time_used] = $end - $start;
   $return = $http;
   } elseif($line) {
   $http = parse_output($line);
   $http[time_used] = $end - $start;
   $return = $http;
   }
   }
   }
   return $return;
   }
  
   function parse_output($line) {
   $lines = explode(\n, $line);
   if(substr($lines[0],0,4)==HTTP) {
   list($http[protocol], $http[result], $h

[PHP] Re: mail() getenv() problems (after 4.1.2 update)...

2002-03-08 Thread Keith Waters

I'm having the same problem -

I've been using the mail() command for quite some time now and it's been
working 100% and executing immediately.

Suddenly, this morning, it is taking about 60 seconds to send mail, delaying
the display of the php web page by that same amount of time.

I have checked the mail server and sending mail from the command prompt
(linux) and there is no delay there.

Does anybody have any clue? I even momentarily downgraded to 4.1.0 to make
sure it wasnt a bug in 4.1.2


Paul [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Can nobody help?  This is so frustrating.  I cannot see what's wrong, open
 to ANY suggestions!

 Thanks.

 Paul
 Paul [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hello,
 
  I wonder if anyone can help me with a problem I have.  I have some sites
  hosted on a Cobalt Raq4 server (not sure if this is relevant).  I
recently
  upgraded PHP from a package at www.pkgmaster.com, and since making this
  upgrade I have problems with PHP that I cannot find the solution to.
 
  I have conacted their 'team' who have thus far offered no explanation,
  saying it must be something else causing these issues with PHP, but I
  haven't made any more changes, just installed the new PHP version.
 
  The problems are with the mail() function taking an AGE to excecute, and
  environmental HTTP header information not being sent/recieved by
getenv().
 
  Some examples follow..
 
  For example, as an extremely basic example of the mail function going
 slow,
  this simple script:
  ?
  mail([EMAIL PROTECTED], Test subject, Test message);
  print finished!;
  ?
 
  Which can be found at http://www.clicktolearn.co.uk/test/mail.php in
 action,
  ran (as it should do) extremely fast the week before I made the upgrade
 from
  the packages.  Now, as you will see, it runs dog slow.
 
  Secondly, the following script shows the lack of headers:
  http://www.clicktolearn.co.uk/test/  (click the link, so there's a
referer
  to the script page)...
 
  ?
  function get_http_headers($url, $proto=HTTP/1.0, $timeout=10) {
  $return = false;
  if (substr($url,0,7)==http://;) {
  $url = substr($url,7);
  }
 
  $parts = parse_url(http://.$url);
 
  $ips = gethostbynamel($parts[host]);
 
  if ($ips[0]) {
  $ip = $ips[0];
  $host = $parts[host];
  $path = ($parts[path]) ? $parts[path] : /;
  $port = ($parts[port]) ? $parts[port] : 80;
 
  $start = time();
  $timeout = $timeout + $start;
 
  if($sock = fsockopen($host, $port)) {
  set_socket_blocking($sock, 0);
  switch($proto) {
  case HTTP/1.1:
  set_socket_blocking($sock, 1);
  fputs($sock, sprintf(HEAD %s
 %s\n,
  $path, $proto));
  fputs($sock, sprintf(Host:
 %s\n\n,
  $host));
  break;
  default:
  fputs($sock, sprintf(HEAD %s
  %s\n\n, $path, $proto));
  }
 
  while(!feof($sock)  $t$timeout) {
  $line .= fgets($sock,1);
  $t = time();
  }
  fclose($sock);
  $end = time();
 
  if ($t=$timeout) {
  $http = parse_output($line);
  $http[result] = 502;
  $http[message] = Timed Out;
  $http[time_used] = $end - $start;
  $return = $http;
  } elseif($line) {
  $http = parse_output($line);
  $http[time_used] = $end - $start;
  $return = $http;
  }
  }
  }
  return $return;
  }
 
  function parse_output($line) {
  $lines = explode(\n, $line);
  if(substr($lines[0],0,4)==HTTP) {
  list($http[protocol], $http[result], $http[message]) =
  split([[:space:]]+,$lines[0],3);
  } else if(substr($lines[0],0,7)==Server:) {
  $http[server] = substr($lines[0],8);
  }
  for ($i=1; $icount($lines); $i++) {
  list($key, $val) = split(:[[:space:]]*, $lines[$i],2);
  $key = strtolower(trim($key));
  if ($key) {
  $http[$key] = trim($val);
  } else {
  break;
  }
  }
  return($http);
  

[PHP] Turn-key output compression support in 4.1.0

2001-12-11 Thread Keith Waters

Hi All - I see this feature mentioned in the release notes - It could be a
nice alternative to mod_gzip if it is what I think it is, but there doesnt
seem to be any documentation on it.  Does anybody out there have an idea?

Regards,
Keith




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