VirtualDarKness
Registered
Hello,
on a Mac OS X Server 10.5 with PHP 5.2.6 i've a problem with an old php script:
Warning: fsockopen() [function.fsockopen]: unable to connect to 127.0.0.1:80 (Connection refused) in /path/to/script.php on line 54
I've tried to write a test script with the followin code:
and it works correctly.. so the problems seems to happen when it tries to connect to localhost.
I've also tried to connect to 127.0.0.1 but got the same error.
any idea? should I change something in my php.ini?
thanks.
bye,
Giovanni.
on a Mac OS X Server 10.5 with PHP 5.2.6 i've a problem with an old php script:
Warning: fsockopen() [function.fsockopen]: unable to connect to 127.0.0.1:80 (Connection refused) in /path/to/script.php on line 54
I've tried to write a test script with the followin code:
Code:
<?php
$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
and it works correctly.. so the problems seems to happen when it tries to connect to localhost.
I've also tried to connect to 127.0.0.1 but got the same error.
any idea? should I change something in my php.ini?
thanks.
bye,
Giovanni.