fsockopen question
soc at visca.com
soc at visca.com
Fri Jun 20 11:15:27 PDT 2008
At 13:00 20/06/08 -0400, Nick Guenther wrote:
>On Fri, Jun 20, 2008 at 11:47 AM, <soc at visca.com> wrote:
> > Greetings:
> >
> > Using OpenBSD 4.2, PHP 5.23.
> >
> > http://visca.com/php/fsockopen.php
> > <?php
> > $fp = fsockopen("localhost", 25, $errno, $errstr);
> > if (!$fp) {
> > echo "ERROR: $errno - $errstr<br />\n";
> > } else {
> > $response = fgets($fp);
> > echo "Response is \"$response\"";
> > }
> > ?>
> >
> > As you'll see if you follow the link, the script hangs for 60
> seconds
> > then prints «Response is ""». Port 25 is open and working.
> >
> > Can anyone suggest where I might go from here to debug this?
>
>Are you sure it's fsockopen? You have to do some configuration to make
>PHP's mail() call work.
Thanks Nick and Peter:
I have the same OpenBSD and PHP versions working on a machine here at
home (http://petonets.com/php/fsockopen.php) and this script works as
advertised, with no 60 second delay, returning:
«Response is "220 pinger.petonets.com ESMTP "»
And another scriplet, on my main server, uses php's mail function and
that works just fine, even from the command line:
$ less mail.php
<?php
$to = 'soc at visca.com';
$subject = 'Prova';
$message = 'hello';
mail($to, $subject, $message);
print "Message sent to $to\n";
?>
$ php mail.php
Message sent to soc at visca.com
(and I get the message)
Any other ideas would be welcome! I've also posted this on the
phpbuilder's list, but no one has answered so far.
--
All the best (Adéu-siau),
Lou Hevly
soc at visca.com
http://visca.com
More information about the Openbsd-newbies
mailing list