2012-06-28 23 views
2

我在Ubuntu 12.04下工作。 我有一个经典的本地主机设置。 APACHE + MYSQL + PHP从本地LAMP访问SoapClient和file_get_contents

的file_get_contents失败的外部URL,但与 'localhost' 的

file_get_contents('http://google.com'); 
PHP Warning: file_get_contents(http://google.com): failed to open stream: HTTP request failed! 

SoapClient的失败对外部URL,但与 'localhost' 的

$wsdl = "http://test.webservices.delijn.be/wsrise/services/travel/WEB-INF/wsdl/RiseWebservices.wsdl"; 
$client = new SoapClient($wsdl, 
array(
     'trace'     => true, 
     'exceptions'   => true, 
     'soap_version'   => SOAP_1_1, 
     'connection_timeout' => 600, 
     'compression' => SOAP_COMPRESSION_ACCEPT , 
     'encoding'=> 'UTF-8', //ISO-8859-1', 
     //'cache_wsdl' => WSDL_CACHE_BOTH, 
     //'host'  => "localhost", 
     //'proxy_host'  => "localhost", 
     //'proxy_port'  => 8080, 
    )); 

SOAP-ERROR: Parsing WSDL: Couldn't load from 
'http://test.webservices.delijn.be/wsrise/services/travel/WEB-INF/wsdl/RiseWebservices.wsdl' : failed to load external entity "http://test.webservices.delijn.be/wsrise/services/travel/WEB-INF/wsdl/RiseWebservices.wsdl" 
本地文件或效果很好本地文件或运行良好

allow_url_fopen选项和allow_include_url是在phpinfo()函数(在/etc/php5/apache2/php.ini集) 禁用防火墙 apparmor的被禁用

了Suhosin补丁安装和我在php.ini

设置suhosin.simulation到真正的代码是在我的生产和临时服务器运行良好

我出的点子,别再找intresting日志或命令,可以检查问题:'(

感谢您的帮助!

+1

@Quasdunk数组中的尾随逗号不会引发语法错误,并且有时需要某些编码标准。 –

+0

你有没有尝试从外壳访问这些网站?只要做'卷曲http:// test.webservices.delijn.be/wsrise/services/travel/WEB-INF/wsdl/RiseWebservices.wsdl' –

+0

@MikeB什么....我的整个生活都是谎言:-D感谢评论,我并没有真正意识到这一点! (但是,如果只有逗号,它确实会抛出异常。) – Quasdunk

回答

1

好的!我找到了一种让它工作的方法。

安装de suhosin-php软件包以便能够使用Module suhosin。 设置suhosin.simulation指令在/etc/php5/con.d/suhosin.conf 须藤服务的Apache2重启

SOAP调用仍然是极其缓慢的,但现在正在

感谢您的帮助!

+0

http://www.hardened-php.net/suhosin/configuration.html#suhosin.simulation – Mark