doudang8824 2014-06-25 08:15
浏览 397
已采纳

file_get_contents(https:// url)失败[关闭]

On my Ubuntu 12.04 server running PHP 5.5 on Lighttpd I have

  • allow_url_fopen On
  • allow_url_include On
  • OpenSSL Support Enabled
  • OpenSSL Library/Header Version 1.0.1 14 Mar 2012

I am not sure this is right but I also put in extension=openssl.so in my php.ini file and rebooted by server. I see no untoward error messages in my logs.

Nevertheless I still get failed to open stream: Connection timed out. The same URL without https works just fine. Am I missing something

  • 写回答

2条回答 默认 最新

  • douci1851 2014-06-25 12:21
    关注

    As someone said above this is a network issue. Actually, I was wrong when I said that http://exmaple.com worked whilst https://example.com did not. I run four servers, call them A, B, C & D at different global locations - two in the US, one in Europe and one in Asia. The URL that I am trying to reach is for another server in the US. After posting this question and reviewing the various comments I explored matters a bit more and discovered that my file_get_contents call was failing only from the Asian server. TraceRoute revealed that the Asian server is simply unable to locate the one I want to reach. So as someone here said - this is a network issue. I am posting this answer so anyone who runs into this thread in quest of a solution to a similar problem realizes that this might well be the problem rather than a PHP configuration thing.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部