PHP Class SoapClient not found Solution

  • 2021-09-11 19:41:38
  • OfStack

To use SoapClient, new added a prompt Class 'SoapClient' not found, and checked phpinfo because this extension was not compiled at the beginning, so we have to add it now.

When php calls webservice, it reports an error similar to the following:

( ! ) Fatal error: Class 'SoapClient' not found in E:/WebSrv/CI/system/libraries/WebService.php on line 17

Solution:

Open php. ini, find php_soap. dll, and remove the preceding semicolon

;extension=php_soap.dll

The premise is that php_soap. dll has been installed

The author's PHP is installed in the/usr/local/php/directory. If it is not installed, please refer to the following method


$ cd /home/downloads/php-5.6.12   #  Enter into  PHP  Source catalog 
$ cd ext/soap  #  Enter  soap  Extended directory 
$ /usr/local/php/bin/phpize #  Ready to add extensions 
$ ./configure -with-php-config=/usr/local/php/bin/php-config --enable-soap   #  Enable  SOAP
$ make
$ make install

After the extension installation is completed, prompt that the extension has been installed in this directory:

Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

Edit the php. ini file, enable the extension_dir extension directory, and add the soap. so extension:


; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/"
; On windows:
; extension_dir = "ext"
extension=soap.so    #  Add  SOAP  Expand 

Restart php-fpm to take effect


kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`

php under Windows. ini Cancel the comment of this line

extension=php_soap.dll


Related articles: