How do I install soap extension?
Asked Answered
B

10

91

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

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

UPDATE:

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

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             ##
#######################################################################

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

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

Breslau answered 24/3, 2010 at 15:52 Comment(0)
D
191

For Windows

  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.

  2. Restart your server.

For 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
Discern answered 14/3, 2014 at 6:25 Comment(8)
For OpenSuse users: one should use sudo zypper install php7.0-soap; however it is needed to provide the correct repositories (sudo zypper repos / sudo zypper addrepo according to en.opensuse.org/Package_repositories) in order to retrieve PHP extensions.Yonita
@Kamafeather, how can I add the repo?Computerize
Read again, I wrote the commands. The correct repo to use depends on Opensuse version and PHP version installed. Check the "devel repository"(download.opensuse.org/repositories/devel:/languages:/php:) and the "Wiki - Additional repositories"(en.opensuse.org/Additional_package_repositories).Yonita
If you use XAMPP on WIN10 there is extension=soap instead extension=php_soap.dll in php.ini. Just uncomment and it will work after restarting apacheIntertype
Thx alot this helped with with php version 7.4Henkel
For php 8.1 : sudo apt-get install php8.1-soapAdjective
@Adjective "E: Unable to locate package php8.1-soap" on ubuntoLandlocked
For Kubernetes : /etc/init.d/apache2 reload, ie #37523838Culp
S
58

In ubuntu to install php_soap on PHP7 use below commands. Reference

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

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

apt-get install php-soap
Subdual answered 7/1, 2017 at 5:46 Comment(0)
C
18

find this line in php.ini :

;extension=soap

then remove the semicolon ; and restart Apache server

Crafty answered 7/8, 2018 at 11:24 Comment(0)
D
7

In Ubuntu with php7.3:

sudo apt install php7.3-soap 
sudo service apache2 restart
Dagger answered 26/4, 2020 at 1:27 Comment(0)
C
4

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
Curate answered 9/1, 2020 at 12:30 Comment(0)
B
2

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 :)

Bristol answered 1/9, 2015 at 18:0 Comment(0)
S
2

How To for Linux Ubuntu...

sudo apt-get install php7.1-soap 

Check if file php_soap.ao exists on /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

to

extension=php_soap.so

sudo systemctl restart apache2

CHecking...

php -m | more
Scree answered 13/5, 2019 at 0:17 Comment(0)
G
1

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.

Goby answered 3/3, 2011 at 8:29 Comment(0)
I
1

For Ubuntu+php 5.6+nginx I used

sudo apt install php5.6-soap
sudo systemctl restart nginx
sudo systemctl restart php5.6-fpm.service

Only after that it started to work.

Irvin answered 2/12, 2021 at 7:14 Comment(0)
T
0

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.

Thriftless answered 24/3, 2010 at 16:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.