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

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


当前回答

要在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部分。

我在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 8:

sudo apt update
sudo apt-get install php8.0-soap

你必须继承nusoop。php类并把它放到你的项目目录中,你可以从网上下载。

使用以下代码:

require_once('nusoap.php');

对于Docker*添加这一行:

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

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