|
#1
| |||
| |||
|
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: 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);
}
?>
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. |
|
#2
| ||||
| ||||
| Quote:
The reason I ask is that it looks like you've used some sample code that somewhere says "path/to/script.php" -- which isn't actually a valid path -- it's an example that's meant to be replaced with the actual path to some script file.
__________________ Mac mini 2.0GHz 10.6.2 • 4GB • 320GB • Superdrive • 4 x 1TB USB 2.0 • LED Cinema Display MacBook 2.0GHz Core 2 Duo - White 10.6.2 • 4GB • 250GB • CD-RW/DVD-ROM iPhone 3G 8GB • iPod Touch 8GB • iPod Photo 60GB • iPod nano 1GB • AT&T U-Verse 12Mb/1.5Mb http://www.jeffhoppe.com |
|
#3
| |||
| |||
| Quote:
thanks for your answer. I wrote it that way as an example.. bye, Giovanni. p.s. anyway that was the path to the script that returned the error message, not the file the script were trying to access to. |
|
#4
| ||||
| ||||
|
Ok, so I assume the basics are covered: that you're actually running a web server on port 80 and it's properly configured, yes? What happens if you use "localhost" instead of "127.0.0.1"? What happens if you use the FQD of the server?
__________________ Mac mini 2.0GHz 10.6.2 • 4GB • 320GB • Superdrive • 4 x 1TB USB 2.0 • LED Cinema Display MacBook 2.0GHz Core 2 Duo - White 10.6.2 • 4GB • 250GB • CD-RW/DVD-ROM iPhone 3G 8GB • iPod Touch 8GB • iPod Photo 60GB • iPod nano 1GB • AT&T U-Verse 12Mb/1.5Mb http://www.jeffhoppe.com |
|
#5
| |||
| |||
| Quote:
Quote:
Quote:
thanks. bye, Giovanni. |
|
#6
| ||||
| ||||
|
Yes, both Mac OS X Client and Mac OS X Server come with a firewall -- in a default install, it's usually turned off, but you may want to check it. I would think that if you enabled Web Sharing that the proper ports would be automatically forwarded, but it never hurts to check: http://www.apple.com/server/macosx/f...etworking.html FQD = "Fully Qualified Domain" -- i.e., "myserver.com" or something like that. Basically, the domain name one would use to connect to the server from the "outside" world. It could also be something like "serverone.local" or something -- whatever you set up the name of the server to be when you installed Mac OS X Server.
__________________ Mac mini 2.0GHz 10.6.2 • 4GB • 320GB • Superdrive • 4 x 1TB USB 2.0 • LED Cinema Display MacBook 2.0GHz Core 2 Duo - White 10.6.2 • 4GB • 250GB • CD-RW/DVD-ROM iPhone 3G 8GB • iPod Touch 8GB • iPod Photo 60GB • iPod nano 1GB • AT&T U-Verse 12Mb/1.5Mb http://www.jeffhoppe.com |
![]() |
| Bookmarks |
| Thread Tools | |
|
|