php 致命错误:找不到“SoapClient”类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11391442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fatal error: Class 'SoapClient' not found
提问by Figen Güng?r
I'm trying a simple web service example and I get this error even though I uncommented extension=php_soap.dllin the php.inifile:
我正在尝试一个简单的 Web 服务示例,即使我extension=php_soap.dll在php.ini文件中取消注释,也会收到此错误:
Fatal error:Class 'SoapClient' not found in C:\Program Files (x86)\EasyPHP-5.3.9\www\server.php on line 2
致命错误:在第 2 行的 C:\Program Files (x86)\EasyPHP-5.3.9\www\server.php 中找不到“SoapClient”类
回答by Morgan Wilde
Diagnose
诊断
Look up the following inside your script file
在脚本文件中查找以下内容
phpinfo();
If you can't find Soap Clientset to enabledlike so:

如果你找不到这样的Soap Client设置enabled:

Fix
使固定
Do the following:
请执行下列操作:
- Locate
php.iniin your apachebin folder, I.eApache/bin/php.ini - Remove the
;from the beginning ofextension=php_soap.dll - Restart your Apache server
- Look up your
phpinfo();again and check if you see a similar picture to the one above - If you do, problem solved!
- 找到
php.ini你的apachebin 文件夹,即Apache/bin/php.ini ;从开头删除extension=php_soap.dll- 重启你的 Apache 服务器
phpinfo();再次查找并检查您是否看到与上面相似的图片- 如果你这样做了,问题就解决了!
On the other hand if this doesn't solve your issue, you may want to check the requirements for SOAP here. Also in the comment section you can find good advice on connecting to https.
另一方面,如果这不能解决您的问题,您可能需要在此处检查SOAP的要求。同样在评论部分,您可以找到关于连接到 https 的好建议。
回答by Nahid
To install SOAP in PHP-7 run following in your Ubuntu terminal:
要在 PHP-7 中安装 SOAP,请在您的 Ubuntu 终端中运行以下命令:
sudo apt-get install php7.0-soap
To install SOAP in PHP-7.1 run following in your Ubuntu terminal:
要在 PHP-7.1 中安装 SOAP,请在您的 Ubuntu 终端中运行以下命令:
sudo apt-get install php7.1-soap
To install SOAP in PHP-7.2 run following in your Ubuntu terminal:
要在 PHP-7.2 中安装 SOAP,请在您的 Ubuntu 终端中运行以下命令:
sudo apt-get install php7.2-soap
To install SOAP in PHP-7.3 run following in your Ubuntu terminal:
要在 PHP-7.3 中安装 SOAP,请在您的 Ubuntu 终端中运行以下命令:
sudo apt-get install php7.3-soap
回答by OZ_
For AWS (RHEL):
对于 AWS (RHEL):
sudo yum install php56-soap
(56 here is 5.6 PHP version - put your version here).
(这里的 56 是 5.6 PHP 版本 - 把你的版本放在这里)。
回答by Jasom Dotnet
To install SOAP in PHP5.6 run following in your Ubuntu 14.04 terminal:
要在 PHP5.6 中安装 SOAP,请在 Ubuntu 14.04 终端中运行以下命令:
sudo apt-get install php5.6-soap
service php5.6-fpm restart
service apache2 restart
See if SOAP was enabled:
查看是否启用了 SOAP:
php -m
(You should see SOAP between returned text.)
(您应该在返回的文本之间看到 SOAP。)
回答by MayTheSForceBeWithYou
I had to run
我不得不跑
php-config --configure-options --enable-soap
as root and restart apache.
以 root 身份重新启动 apache。
That worked! Now my phpinfo() call shows the SOAP section.
那行得通!现在我的 phpinfo() 调用显示了 SOAP 部分。
回答by RafaSashi
I couln't findthe SOAPsection in phpinfo()so I had to install it.
我找不到该SOAP部分,phpinfo()所以我不得不安装它。
For information the SOAPextension requires the libxmlPHP extension. This means that passing in --enable-libxmlis also required according to http://php.net/manual/en/soap.requirements.php
有关信息,该SOAP扩展需要libxmlPHP 扩展。这意味着--enable-libxml根据http://php.net/manual/en/soap.requirements.php也需要传入
From WHM panel
从WHM面板
- Software ? Module Installers ? PHP Extensions & Applications Package
Install SOAP 0.13.0
WARNING: "pear/HTTP_Request" is deprecated in favor of "pear/HTTP_Request2"
install ok: channel://pear.php.net/SOAP-0.13.0
Install HTTP_Request2 (optional)
install ok: channel://pear.php.net/HTTP_Request2
Restart Services ? HTTP Server (Apache)
- 软件 ?模块安装程序 ? PHP 扩展和应用程序包
安装 SOAP 0.13.0
警告:“pear/HTTP_Request”已被弃用,取而代之的是“pear/HTTP_Request2”
安装确定:channel://pear.php.net/SOAP-0.13.0
安装 HTTP_Request2(可选)
安装确定:channel://pear.php.net/HTTP_Request2
重启服务?HTTP 服务器 (Apache)
From shell command
从 shell 命令
1.pear install SOAP
1.梨安装SOAP
2.reboot
2.重启
回答by Nanhe Kumar
I solved this issue on PHP 7.0.22-0ubuntu0.16.04.1 nginx
我在 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
回答by Attila Fulop
For Docker* add this line:
对于 Docker*,添加以下行:
RUN apt-get update && \
apt-get install -y libxml2-dev && \
docker-php-ext-install soap
*: For debian based images, ie. won't work for alpine variants.
*:对于基于 debian 的图像,即。不适用于高山变种。
回答by Jakub Adamec
For XAMPP users, open php.inifile located in C:/xampp/phpand remove the ;from the beginning of extension=soap. Then restart Apache and that's it!
对于XAMPP的用户,打开php.ini文件位于C:/xampp/php并删除;从年初extension=soap。然后重新启动Apache,就是这样!
回答by PJunior
On Centos 7.8 and PHP 7.3
在 Centos 7.8 和 PHP 7.3 上
yum install php-soap
service httpd restart

