I have a php script using nusoap to connect to a web service on:
$uri = 'http://soap.1011.my-online-check.com:8080/avavoip_gate.php?wsdl';
$client = new nusoap_client($uri, true, false, false, false, false, 30, 90);
$client->setHeaders($headers);
$result = $client->call($method, $args);
It works fine on my Mac.
However, when I upload the very same script to both my webhosting providers both using cpanel, one of which is bluehost.com, the script fails with the following error:
Error: wsdl error: Getting 'http://soap.1011.my-online开发者_如何学编程-check.com:8080/avavoip_gate.php?wsdl - HTTP ERROR: Couldn't open socket connection to server 'http://soap.1011.my-online-check.com:8080/avavoip_gate.php?wsdl, Error (110): Connection timed out
So I installed CentOS on my other PC to test the script. Initially I got the same error above, but after setting SELinux to Permissive instead of Enforcing, the script worked fine too.
I have tried asking my hosting providers to change the SELinux settings but to no avail. Any advice on how I could possibly get my script to work on my webhosting providers?
You might also try using curl as an alternative. For your nusoap client:
$client->use_curl = TRUE;
before calling $client->call
I have tried asking my hosting providers to change the SELinux settings but to no avail
Did they refuse, or did they simply not respond?
The SELinux restriction in question pretty much boils down to "can Apache and things it spawns make HTTP connections?", so if they're unwilling to change that permission, you're pretty much up a creek.
That being said, a timeout is not usually what you get when SELinux blocks an action. Usually you'd see a "permission denied" instead. There may be something else blocking the outgoing connection.
精彩评论