如何安装soap扩展?

2021-12-24 00:00:00 php soap dreamhost

如何安装 Soap?

我收到此错误:

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

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

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

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

更新:

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

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

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

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

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

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

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

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

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

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

推荐答案

For Windows

  1. 在php.ini中找到extension=php_soap.dllextension=soap,去掉开头的注释分号线.最后检查conf.d目录下的soap.ini.

  1. Find extension=php_soap.dll or extension=soap in php.ini and remove the commenting semicolon at the beginning of the line. Eventually check for soap.ini under the conf.d directory.

重启你的服务器.

对于 Linux

Ubuntu:

PHP7

Apache

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

PHP5

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

OpenSuse:

PHP7

Apache

sudo zypper in php7-soap
sudo systemctl restart apache2

Nginx

sudo zypper in php7-soap
sudo systemctl restart nginx

相关文章