【问题标题】:php and ssl on ubuntu 18.04ubuntu 18.04 上的 php 和 ssl
【发布时间】:2020-04-16 07:11:34
【问题描述】:

在运行$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); 时,我收到一个 500 内部服务器错误并且它完全失败。

运行$fp = fsockopen ('https://www.sandbox.paypal.com', 443, $errno, $errstr, 30); 时出现异常:

无法找到套接字传输“https” - 您是否忘记启用 是你配置PHP的时候吗?

当我运行 php -i | grep -i openssl 时,我得到了

openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.1  11 Sep 2018
OpenSSL Header Version => OpenSSL 1.1.1  11 Sep 2018
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled

好像 ssl 已启用并正确配置。 在 php.ini 中, extension=...ssl 被 ; 注释掉,所以我很困惑。我怎样才能从这里开始让它工作?

谢谢

添加了 SSL 的 phpinfo 输出

【问题讨论】:

    标签: openssl paypal-sandbox ubuntu-18.04 php-7.2


    【解决方案1】:

    ssl:// 对 fsockopen 是正确的,而不是 https://

    试试 ipnpb.sandbox.paypal.com,再试试 curl

    https://github.com/paypal/ipn-code-samples/blob/master/php/PaypalIPN.php

    【讨论】:

    • 我使用的是 pdt 而不是 ipn,所以我使用了 pdt 代码并将一些 echo 作为调试。看起来像 $ch = curl_init();卡住了,即使是 try/catch 也没有触发
    • running curl -I google.com from ssh 显示结果,这意味着 curl 在那里并且正在工作
    猜你喜欢
    • 2018-10-13
    • 2019-04-21
    • 2019-07-10
    • 1970-01-01
    • 2019-04-30
    • 2019-01-09
    • 2019-03-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多