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

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


当前回答

对于Docker*添加这一行:

RUN apt-get update && \
    apt-get install -y libxml2-dev && \
    docker-php-ext-install soap

*:对于基于debian的图像,即。对高山变种无效。

其他回答

我在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-7中安装SOAP,请在Ubuntu终端上执行以下命令:

sudo apt-get install php7.0-soap

要在PHP-7.1中安装SOAP,请在Ubuntu终端上执行以下命令:

sudo apt-get install php7.1-soap

要在PHP-7.2中安装SOAP,请在Ubuntu终端上执行以下命令:

sudo apt-get install php7.2-soap

要在PHP-7.3中安装SOAP,请在Ubuntu终端上执行以下命令:

sudo apt-get install php7.3-soap

对于AWS (RHEL):

sudo yum install php56-soap

(56这里是5.6 PHP版本-把你的版本放在这里)。

我不得不逃跑

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

以root用户重启apache。

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

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