SoapServer :: SoapServer():SSL操作失败,代码为1

时间:2018-02-08 13:24:06

标签: php web-services yii wsdl2php

我通过Yii公开了几个网络服务。从PHP 5.5.x升级到PHP 5.6.33后,我面临以下错误

SoapServer::SoapServer(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

错误发生在framework / web / services / CWebService.php(1.1.19)的第166行到目前为止我还没有找到任何解决方法,options属性受到保护,不知道如何绕过这个问题,但仍然http://php.net/manual/en/soapserver.soapserver.php似乎不支持与SoapClient相同的选项

            $options["stream_context"] = stream_context_create([ 
                "ssl" => [ 
                    // set some SSL/TLS specific options 
                    "verify_peer" => false, 
                    "verify_peer_name" => false, 
                    "allow_self_signed" => true 
                ]]); 

2 个答案:

答案 0 :(得分:1)

我们最终认为这是服务器配置问题。生产服务器没有遇到此问题,因为证书是从已知的权限签署的,但是在私有服务器中,我们需要编辑php.ini文件

openssl.cafile = "/etc/path/to/pem/file.pem"

答案 1 :(得分:0)

当我尝试在开发环境中创建SoapServer时,在Linux(Ubuntu)和PHP7.2上也出现了错误。 如果您不想全局设置PHP openssl.cafile ,只需将根CA复制到正确的文件夹中并更新证书:

sudo cp my_root_ca.pem /usr/share/ca-certificates/my_root_ca.crt
sudo dpkg-reconfigure ca-certificates
sudo update-ca-certificates

在重新配置ca证书时,您需要选择自己的证书并激活它。 (如果您在开发环境中不再需要根CA,只需再次重新配置证书,请从列表中取消选择您的CA,最后更新证书。)