doushouj966020
2014-11-26 12:51
浏览 44
已采纳

Apache中的PHP Curl库出现SSL错误

I have RHEL server on which PHP websites are hosted using Apache web server. In one website I'm using PHP Curl library to connect to some services. These services make use of SSL (https).

When I browse any PHP page which makes SSL calls using Curl, I get below error:

Problem with the SSL CA cert (path? access rights?)

If I run the same PHP script from command-line on my server, it works fine. Only when I browse it I get above error.

I have already tried the solution given in http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/ but it does not work.

If there is anything else I need to do, please let me know.

图片转代码服务由CSDN问答提供 功能建议

我有RHEL服务器,使用Apache Web服务器托管PHP网站。 在一个网站中,我使用PHP Curl库连接到某些服务。 这些服务使用SSL(https)。

当我浏览使用Curl进行SSL调用的任何PHP页面时,我得到以下错误:

SSL CA问题 cert(路径?访问权限?)

如果我在服务器上从命令行运行相同的PHP脚本,它可以正常工作。 只有当我浏览它时才会出现上述错误。

我已经尝试过 http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your -php-config / 但它不起作用。

如果还有什么我需要做的,请告诉我。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douxi4287 2014-11-26 13:53
    已采纳

    As mentioned earlier, I tried the solution given at http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/

    However, the Apache server was not taking the php.ini changes even after restarting it. When I restarted my Linux machine, it worked. Looks like Apache might be caching php.ini somewhere and it got cleared only by restarting machine.

    点赞 打赏 评论
  • dss524049 2014-11-26 13:34

    Hypothesis:

    Could be that the user that's running Apache is so restricted that it can't get at the curl CA store. Try logging in as the web user, e.g. www-data and cd'ing to the directory with curl's files. At some time you might get an access-denied error. Finally try cat to display the file (still as Apache user). You could get an access-denied error there too.

    Wherever the error occurs, either open up the permissions to allow the Apache user to access the file, or run Apache as another user.

    点赞 打赏 评论

相关推荐 更多相似问题