InfiniteGeoff
InfiniteGeoff

Reputation: 41

PHP Error Class 'SoapClient' not found

I was trying to install Wordpress on our server to test, but in order to do that I had to upgrade our current PHP version to 5.3. I upgraded our PHP and I am now finding that our Purolator shipping module is no longer working. According to our host support the "purolator.php" file is missing data that the new version of PHP requires. Unfortunately, I can't revert our PHP version back and our programmer is away.

This is the error message I was able to get from our website host support team:

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 

These are lines 40 to 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;
}

Any help would be greatly appreciated.

Upvotes: 3

Views: 16138

Answers (5)

Saurabh Rana
Saurabh Rana

Reputation: 3540

It is already posted here

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!

Upvotes: 1

Yelmox
Yelmox

Reputation: 47

Enable the SOAP extension, require it in your composer.json like so:

{
  "require": {
    "ext-soap": "*"
  }
}

Upvotes: -2

InfiniteGeoff
InfiniteGeoff

Reputation: 41

So we reverted back to an older version of PHP, and re-enabled SOAP. apparently that was the issue, not sure why that didn't work with the newer version of PHP.

Again thank you for all of your help. This is a great community.

Upvotes: 1

Ross Smith II
Ross Smith II

Reputation: 12179

You will need to add (or remove any comment characters before)

extension=soap.so

to your php.ini file, and then restart the web server.

If you are having trouble finding your php.ini file, create a page with the following:

<?php phpinfo();

and load that file in your browser.

On some systems, this setting may not actually live in php.ini. For example, if you are using Zend Server, the setting would live in /usr/local/zend/etc/conf.d/soap.ini.

Upvotes: 3

Romain
Romain

Reputation: 6410

It seems like you did not have installed the php-soap package on your server. Type

phpinfo();

in your code and check if 'Soap Client' is 'enabled'. If not, I don't know your distribution and package manager, but here is the code for Fedora I use:

$ yum install php-soap

I suggest to do it with your programmer back or a sys admin by your sides, you never know what could happen. A backup is also useful before any installation!

Upvotes: 4

Related Questions