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

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


当前回答

在Centos 7.8和PHP 7.3上

yum install php-soap
service httpd restart

其他回答

我不得不逃跑

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

以root用户重启apache。

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

对于AWS (RHEL):

sudo yum install php56-soap

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

用于PHP 7.4和Docker 在Dockerfile中添加这一行:

RUN apt-get update && apt-get install -y \
libxml2-dev \

RUN docker-php-ext-install 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-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