php 如何安装soap扩展?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2509143/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 06:45:11  来源:igfitidea点击:

How do I install soap extension?

phpsoapdreamhost

提问by Loreto Gabawa Jr.

How do I install Soap?

如何安装肥皂?

I got this error:

我收到此错误:

Fatal error: Class 'SoapClient' not found in /home/user/mysite.com/path/to/file.php on line 16

致命错误:在第 16 行的 /home/user/mysite.com/path/to/file.php 中找不到“SoapClient”类

I am hosting my site in DreamHost and they don't support any third-party installation.

我在 DreamHost 中托管我的网站,他们不支持任何第三方安装。

UPDATE:

更新:

I copied the php.ini file with this script: http://sxi.sabrextreme.com/dh-phpini

我用这个脚本复制了 php.ini 文件: http://sxi.sabrextreme.com/dh-phpini

I am using an API from a website and it says something like this:

我正在使用来自网站的 API,它说的是这样的:

#######################################################################
## You need to enable the following extensions in your PHP.ini file??##
## php_openssl.dll????????? ##
## php_soap.dll?????????????##
#######################################################################

and here are the list of extensions my php.ini file has:

这是我的 php.ini 文件的扩展名列表:

extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_java.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
;extension=php_mysql.dll
;extension=php_oci8.dll
**extension=php_openssl.dll**
;extension=php_oracle.dll
;extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_w32api.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_yaz.dll
;extension=php_zip.dll

The problem is, the extension php_soap.dll is not found there.

问题是,在那里找不到扩展名 php_soap.dll。

回答by M Arfan

For Windows

对于 Windows

  1. Find extension=php_soap.dllor extension=soapin php.iniand remove the commenting semicolon at the beginning of the line. Eventually check for soap.iniunder the conf.ddirectory.

  2. Restart your server.

  1. php.ini 中找到extension=php_soap.dll或并删除该行开头的注释分号。最终在conf.d目录下检查。extension=soapsoap.ini

  2. 重新启动您的服务器。

For Linux

对于 Linux

Ubuntu:

Ubuntu:

PHP7

PHP7

Apache

阿帕奇

sudo apt-get install php7.0-soap 
sudo systemctl restart apache2

PHP5

PHP5

sudo apt-get install php-soap
sudo systemctl restart apache2

OpenSuse:

OpenSuse:

PHP7

PHP7

Apache

阿帕奇

sudo zypper in php7-soap
sudo systemctl restart apache2

Nginx

nginx

sudo zypper in php7-soap
sudo systemctl restart nginx

回答by TIGER

In ubuntuto install php_soapon PHP7use below commands. Reference

Ubuntu的安装php_soapPHP7下面的命令使用。参考

sudo apt-get install php7.0-soap
sudo systemctl restart apache2.service

For older version of php use below command and restart apache.

对于旧版本的 php,请使用以下命令并重新启动 apache。

apt-get install php-soap

回答by Gouda Elalfy

find this line in php.ini :

在 php.ini 中找到这一行:

;extension=soap

then remove the semicolon ;and restart Apache server

然后删除分号;并重新启动Apache服务器

回答by Emerson Pereira da Silva

How To for Linux Ubuntu...

如何为 Linux Ubuntu...

sudo apt-get install php7.1-soap 

Check if file php_soap.aoexists on /usr/lib/php/20160303/

检查文件是否php_soap.ao存在于/usr/lib/php/20160303/

ls /usr/lib/php/20160303/ | grep -i soap
soap.so
php_soap.so
sudo vi /etc/php/7.1/cli/php.ini

Change the line :

更改行:

;extension=php_soap.dll

;extension=php_soap.dll

to

extension=php_soap.so

extension=php_soap.so

sudo systemctl restart apache2

CHecking...

检查...

php -m | more

回答by Yash

Please follow the below steps :

请按照以下步骤操作:

 1) Locate php.ini in your apache bin folder, I.e Apache/bin/php.ini
 2) Remove the ; from the beginning of extension=php_soap.dll
 3) Restart your Apache server (by using : 
    # /etc/init.d/apache2 restart OR 
    $ sudo /etc/init.d/apache2 restart OR 
    $ sudo service apache2 restart)
 4) Look up your phpinfo();

 you may check here as well,if this does not solve your issue:  
 https://www.php.net/manual/en/soap.requirements.php

回答by franc

I had the same problem, there was no extension=php_soap.dll in my php.ini But this was because I had copied the php.ini from a old and previous php version (not a good idea). I found the dll in the ext directory so I just could put it myself into the php.ini extension=php_soap.dll After Apache restart all worked with soap :)

我遇到了同样的问题,我的 php.ini 中没有 extension=php_soap.dll 但这是因为我从旧的和以前的 php 版本中复制了 php.ini(不是一个好主意)。我在 ext 目录中找到了 dll,所以我可以将它自己放入 php.ini extension=php_soap.dll Apache 重新启动后,所有与soap 一起工作:)

回答by rosswil

Dreamhost now includes SoapClient in their PHP 5.3 builds. You can switch your version of php in the domain setup section of the dreamhost control panel.

Dreamhost 现在在其 PHP 5.3 版本中包含 SoapClient。您可以在dreamhost 控制面板的域设置部分切换您的php 版本。

回答by prodigitalson

They dont support it as in in they wont help you or be responsible for you hosing anything, but you can install custom extensions. To do so you need to first set up a local install of php 5, during that process you can compile in extensions you need or you can add them dynamically to the php.ini after the fact.

他们不支持它,因为他们不会帮助您或负责您冲洗任何东西,但您可以安装自定义扩展。为此,您需要首先设置 php 5 的本地安装,在此过程中您可以编译所需的扩展,或者事后将它们动态添加到 php.ini。

回答by fcva

In Ubuntu with php7.3:

在带有 php7.3 的 Ubuntu 中:

sudo apt install php7.3-soap 
sudo service apache2 restart