我正在尝试一个简单的web服务示例,即使我在php.ini文件中未注释extension=php_soap.dll,我也会得到这个错误:

致命错误:类'SoapClient'没有在C:\Program Files (x86)\ EasyPHP-5.3.9\www\server.php第2行找到


当前回答

在我的案例中,Symfony缓存导致了问题, 运行composer安装后,问题消失了。

其他回答

要在PHP5.6中安装SOAP,请在Ubuntu 14.04终端上执行以下命令:

sudo apt-get install php5.6-soap
service php5.6-fpm restart
service apache2 restart

查看是否启用了SOAP:

php -m

(您应该在返回的文本之间看到SOAP。)

我在PHP 7.0.22-0ubuntu0.16.04.1 nginx上解决了这个问题

sudo apt-get install php7.0-soap

sudo systemctl restart php7.0-fpm
sudo systemctl restart nginx

我不得不逃跑

php-config --configure-options --enable-soap 

以root用户重启apache。

那工作!现在我的phpinfo()调用显示SOAP部分。

在Centos 7.8和PHP 7.3上

yum install php-soap
service httpd restart

我也遇到过类似的问题。这是由于范围的问题,并通过用新的\SoapClient取代新的SoapClient来解决。