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

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


当前回答

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

其他回答

在Centos 7.8和PHP 7.3上

yum install php-soap
service httpd restart

要在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

我不得不逃跑

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

以root用户重启apache。

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

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

对于Docker*添加这一行:

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

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