5

I am integrating a payment gateway using SOAP. When i am calling service function using Wamp its working well. But on my live server it is giving folloing error- Class 'SoapClient' not found

the code i am using is

<?php
try
{
$soap_client=new SoapClient("WebServiceLink/service.asmx?WSDL");

$quote=$soap_client->PGI_TRANS("PassedParameter");
    echo $quote->PGI_TRANSResult;
}
catch(SoapFault $exception)
{
    echo $exception->getmessage();
}
?>
dev-null-dweller
  • 29,274
  • 3
  • 65
  • 85
mayank
  • 75
  • 2
  • 2
  • 6
  • 3
    possible duplicate of [Fatal error: Class 'SoapClient' not found](http://stackoverflow.com/questions/11391442/fatal-error-class-soapclient-not-found) – dev-null-dweller May 23 '13 at 18:11

5 Answers5

7

enable your soap extension in php. open php.ini find the line have "php_soap" and uncomment this line, restart web server, problem solved.

Nick
  • 10,904
  • 10
  • 49
  • 78
Harrison Wang
  • 146
  • 1
  • 5
4

You shouldn't have to modify php.ini to enable soap on modern distributions. If it's not enabled, the package probably isn't installed. Once you install the correct package, your distro should enable the correct php.ini settings for you.

On Ubuntu:

sudo apt-get install php-soap

will install and enable the soap extensions for you.

Nick
  • 10,904
  • 10
  • 49
  • 78
0

You have to inherit nusoap.php class and put it in your project directory, you can download it from the Internet.

Download Link: http://sourceforge.net/projects/nusoap/

Use this code:

require_once('nusoap.php');

Mayur
  • 3
  • 2
0

For Ubuntu17.10 Artful I've used the following command to view exact package name (it can be different).

>> apt-cache search php | grep -i soap
libnusoap-php - SOAP toolkit for PHP
php7.1-soap - SOAP module for PHP
python-pysimplesoap - simple and lightweight SOAP Library (Python 2)
python3-pysimplesoap - simple and lightweight SOAP Library (Python 3)
php-soap - SOAP module for PHP [default]
php5.6-soap - SOAP module for PHP
php7.0-soap - SOAP module for PHP
php7.2-soap - SOAP module for PHP

That's how I get the name. Then just install it.

sudo apt-get install php5.6-soap

P.S. Don't forget to update repository sudo apt-get install php-soap

shukshin.ivan
  • 11,075
  • 4
  • 53
  • 69
0

For Ubuntu, running the following commands fixed my issue,

sudo apt-get install php-soap

then run

sudo service apache2 restart
Jackie Lee
  • 11
  • 3