3

我试图在我们的服务器上安装 Wordpress 进行测试,但为了做到这一点,我必须将我们当前的 PHP 版本升级到 5.3。我升级了我们的 PHP,现在我发现我们的 Purolator 运输模块不再工作。根据我们的主机支持,“purolator.php”文件缺少新版本 PHP 所需的数据。不幸的是,我无法恢复我们的 PHP 版本并且我们的程序员不在了。

这是我从我们的网站托管支持团队获得的错误消息:

tail /var/www/vhosts/phantomcables.com/statistics/logs/error_log -f 
[Thu Jul 19 08:34:28 2012] [error] [client 70.51.168.201] PHP Fatal 
error:  Class 'SoapClient' not found in 
/var/www/vhosts/phantomcables.com/httpdocs/shippings/purolator.php on line 
49, referer: https://phantomcables.com/index.php?dispatch=checkout.cart 

这些是第 40 到 72 行:

function createPWSSOAPClient()
{
    /** Purpose : Creates a SOAP Client in Non-WSDL mode with the appropriate authentication and 
    *           header information
    **/
    //Set the parameters for the Non-WSDL mode SOAP communication with your Development/Production credentials
    //echo DIR_SHIPPING_FILES."estimatingservice.wsdl";

    $url = "https://webservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx";
    $client = new SoapClient( DIR_SHIPPING_FILES."estimatingservice.wsdl", 
                              array (
                                        'trace'         =>  true,
                                        'location'      =>  $url,
                                        'uri'           =>  "http://purolator.com/pws/datatypes/v1",
                                        'login'         =>  PRODUCTION_KEY,
                                        'password'      =>  PRODUCTION_PASS
                                    )
                            );

    //Define the SOAP Envelope Headers
    $headers[] = new SoapHeader ( 'http://purolator.com/pws/datatypes/v1', 'RequestContext', 
                                  array (
                                            'Version'           =>  '1.0',
                                            'Language'          =>  'en',
                                            'GroupID'           =>  'xxx',
                                            'RequestReference'  =>  'Rating Example'
                                       )
                                ); 
    //Apply the SOAP Header to your client                            
    $client->__setSoapHeaders($headers);

    return $client;
}

任何帮助将不胜感激。

4

5 回答 5

4

好像您没有在服务器上安装php-soap包。类型

phpinfo();

在您的代码中并检查“Soap Client”是否已“启用”。如果不是,我不知道你的发行版和包管理器,但这里是我使用的 Fedora 代码:

$ yum install php-soap

我建议与你的程序员或你身边的系统管理员一起做,你永远不知道会发生什么。在任何安装之前备份也很有用!

于 2012-07-19T15:15:50.457 回答
3

您将需要添加(或之前删除任何评论字符)

extension=soap.so

到您的php.ini文件,然后重新启动 Web 服务器。

如果您在查找php.ini文件时遇到问题,请创建一个包含以下内容的页面:

<?php phpinfo();

并在浏览器中加载该文件。

在某些系统上,此设置可能实际上并不存在于php.ini. 例如,如果您使用 Zend Server,该设置将位于/usr/local/zend/etc/conf.d/soap.ini.

于 2012-07-19T15:16:26.070 回答
1

所以我们恢复到旧版本的 PHP,并重新启用 SOAP。显然这就是问题所在,不知道为什么这不适用于较新版本的 PHP。

再次感谢您的所有帮助。这是一个很棒的社区。

于 2012-07-20T17:17:10.540 回答
1

It is already posted here

Do the following:

Do the following:

Locate php.ini in your apache bin folder, I.e Apache/bin/php.ini
Remove the ; from the beginning of extension=php_soap.dll
Restart your Apache server
Look up your phpinfo(); again and check if you see a similar picture to the one above
If you do, problem solved!
于 2013-11-24T08:56:43.110 回答
-2

启用 SOAP 扩展,在 composer.json 中要求它,如下所示:

{
  "require": {
    "ext-soap": "*"
  }
}
于 2014-05-19T14:06:32.693 回答