RE: Re: can't get fsockopen() to work through IIS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is almost surely a permissions problem. By default IIS will run as
a very low privileged user. I suggest in the IIS configuration you try
and run the vhost as your login user on the Windows machine and see what
happens.
Make sure your php.ini has fcgi.impersonate=1

Andi

> -----Original Message-----
> From: Evan Burkitt [mailto:evanb@xxxxxxxxxxxxxx]
> Sent: Friday, October 17, 2008 4:07 PM
> To: php-windows@xxxxxxxxxxxxx
> Subject:  Re: can't get fsockopen() to work through IIS
> 
> "Elizabeth M Smith" <auroraeosrose@xxxxxxxxx> wrote in message
> news:7B.96.19022.99709F84@xxxxxxxxxxxxxxx
> > Take out the @ in front of fsockopen and see what the actual error
is
> > would be the first step - it's generally a good idea to have E_ALL
on
> > and all @ operators removed when trying to debug something
> >
> 
> Thanks for your reply, Elizabeth. I cobbled my script up from bits of
the
> 3rd-party application I'm trying to get running. I know little enough
about
> PHP that I didn't notice the '@', nor did I know its significance. My
> updated script is below. PHP now reports the following:
> 
> Warning: fsockopen() [function.fsockopen]: unable to connect to
> localhost:110 (Unknown error) in C:\Inetpub\wwwroot\socket_test.php on
line
> 12
> 
> errno is still 0. "Unknown error" sounds straight from Windows'
> carefully-crafted assortment of information-free error messages. :)
> 
> From http://us2.php.net/manual/en/function.fsockopen.php: "If the
value
> returned in errno  is 0 and the function returned FALSE, it is an
indication
> that the error occurred before the connect() call. This is most likely
due
> to a problem initializing the socket." Keep in mind that the
fsockopen()
> call succeeds when run from the command line. My suspicion is that IIS
is
> preventing PHP from opening the socket, but I can't find anything on
the Web
> discussing this either in terms of IIS alone or it in conjuction with
PHP.
> 
> <?php
> $host = "localhost";
> $port = "110";
> error_reporting(E_ALL);
> ?>
> <html>
> <h1>Attempting to open socket on host '<?php echo ("$host")?>' at port
> '<?php echo ("$port")?>'</h1>
> <h2>
> <?php
>  $errno = 0;
>  $errstr = "<no error reported>";
>  $fp = fsockopen($host, $port, $errno, $errstr);
>  if ($fp) {
>   echo "Socket connection established";
>   fclose($fp);
>     }
>  else {
>     echo "Could not connect to $host at port $port (\$errno=$errno;
> \$errstr=$errstr)";
>  }
> ?>
> </h2>
> </html>
> 
> 
> 
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux