0
votes

I am using Virtuablbox. On my host I am running a PHP application that should connect to another application on my guest's web server.

I am using ip when trying to connect.

I can connect to exactly the same URL form the browser and it works.

From PHP I can connect to URLs on the internet with success.

I need som help with ideas (or solutions) what the problem can be. Directions to look for a solution is also fine. I find it very difficult to find a solution.

Exact error message:

[Sat Jul 30 19:35:10 2011] [error] [client ::1] PHP Warning: fopen(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Library/WebServer/Documents/SMICTestProject/test.php on line 10

[Sat Jul 30 19:35:10 2011] [error] [client ::1] PHP Warning: fopen(http://\xef\xbb\xbf192.168.1.105/otrs/test.pl): failed to open stream: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Library/WebServer/Documents/SMICTestProject/test.php on line 10

This is my PHP-file running on the host:

<?php

$handle = fopen("http://192.168.1.105/otrs/test.pl", "r");
if(!$handle){

    echo "Failed";
}else{

    echo "Succeeded";
}


?>

The file I'm trying to connect to is a PERL file.

Guest is using OpenSUSE/Apache.

My host is Mac OsX and I'm using apache for PHP as well.

"allow_url_fopen = On" in php.ini.

Thank you in advance!

3

3 Answers

3
votes

Is your VirtualBox host configured to run in Bridged mode? The default NAT mode in VirtualBox will prevent any external (host) requests to reach the guest.

From which browser were you exactly able to connect to the requested resource - the one inside the guest or inside the host OS?

1
votes

Sounds like you don't have the 'allow_url_fopen' set in your PHP.INI file.

Check this out for more info: http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

0
votes

Problem is solved. I have no idea what the problem was but restaring everyting fixed it. I am sitting on a different network, but I guess that shouldn't matter.