That's much the question. I have PHP 5.2.9 on Apache and I cannot upgrade PHP. Is there a way for me to enable SOAP in PHP 5.2.9? The PHP manual did not help at all when it said, "To enable SOAP support, configure PHP with --enable-soap ." How do I configure?
-
1Did you install php from a pre-made package? Check your distro's respositor and seee if there's a soap package available. – Marc B Jul 20 '12 at 17:49
-
no i didn't install it. I was hoping editing php.ini was all I needed to enable SOAP.. but it seems like it requires something more. – netrox Jul 20 '12 at 17:51
-
What is your distro? You probably can avoid configuring and compiling PHP from source. There is very likely a package you can install. – ghbarratt Jul 20 '12 at 18:01
-
If it's your machine, there's really no such thing as "cannot upgrade PHP". Worst case, you build from source and stick it in /usr/local or something. – cHao Jul 20 '12 at 18:10
-
The os is Fedora (linux 2.6.27.41-170.2.117.fc10.i686 gnome 2.24.3 – netrox Jul 20 '12 at 18:19
-
https://admin.fedoraproject.org/pkgdb/acls/list/?searchwords=php*soap – Marc B Jul 20 '12 at 18:39
3 Answers
Getting SOAP working usually does not require compiling PHP from source. I would recommend trying that only as a last option.
For good measure, check to see what your phpinfo says, if anything, about SOAP extensions:
$ php -i | grep -i soap
to ensure that it is the PHP extension that is missing.
Assuming you do not see anything about SOAP in the phpinfo, see what PHP SOAP packages might be available to you.
In Ubuntu/Debian you can search with:
$ apt-cache search php | grep -i soap
or in RHEL/Fedora you can search with:
$ yum search php | grep -i soap
There are usually two PHP SOAP packages available to you, usually php-soap
and php-nusoap
. php-soap
is typically what you get with configuring PHP with --enable-soap
.
In Ubuntu/Debian you can install with:
$ sudo apt-get install php-soap
Or in RHEL/Fedora you can install with:
$ sudo yum install php-soap
After the installation, you might need to place an ini file and restart Apache.

- 11,496
- 4
- 41
- 41
-
i installed it and when i run the command line: php -i | grep -i soap. I get soap Soap Client => enabled Soap Server => enabled soap.wsdl_cache => 1 => 1 soap.wsdl_cache_dir => /tmp => /tmp soap.wsdl_cache_enabled => 1 => 1 soap.wsdl_cache_limit => 5 => 5 soap.wsdl_cache_ttl => 86400 => 86400 . But i dont know the place of ini file that you mention above. i added it in /etc/php5/{cgi, cli, fpm} but it isn't work. there dont have soap.so in /usr/lib/php5/module or soap.ini file in /etc/php5/conf.d/ – biolinh Sep 24 '14 at 06:50
-
1
-
19
-
1Running `apt-get install php-soap` on a Ubuntu 16.04 with PHP7.0 still worked for me. – Pawel Feb 28 '17 at 14:47
-
-
Running php7.2 with Easyengine on Ubuntu 16.04 here.. Firing the command `sudo apt-get install php7.2-soap` and then `sudo service php7.2-fpm restart` on terminal did the trick for me! Thanks! Extra tip: It's a good ideia to check the php.ini settings for `;extension=soap` as it might or might not be enabled. Simply remove the `;` before the extension's name (uncomment it) to enable it. – Adriano Monecchi Sep 02 '18 at 08:00
-
For PHP7: You don't need to specify the version number, just do: `apt-get install php-soap`. It will auto-detect the version for you based on your OS version. Running that command on 20.04.1, Ubuntu outputs: The following additional packages will be installed: php7.4-soap The following NEW packages will be installed: php-soap php7.4-soap. If you specify the specific version in your `apt-get` command, as in the above comment, you may install an outdated version. – jbobbins Sep 21 '20 at 22:03
In case that you have Ubuntu in your machine, the following steps will help you:
- Check first in your php testing file if you have soap (client / server)or not by using phpinfo(); and check results in the browser. In case that you have it, it will seems like the following image ( If not go to step 2 ):
Open your terminal and paste: sudo apt-get install php-soap.
Restart your apache2 server in terminal : service apache2 restart.
To check use your php test file again to be seems like mine in step 1.

- 493
- 1
- 7
- 11
-
if you have Ubuntu ver 16.04 in step 2 you can type only:sudo apt install php-soap. – Noha Salah Jul 06 '17 at 11:48
-
1If your PHP is running under FHM, then you may also need `sudo service php-fpm restart` as I did on AWS – Henry Troup Aug 29 '18 at 12:44
As far as your question goes: no, if activating from .ini
is not enough and you can't upgrade PHP, there's not much you can do. Some modules, but not all, can be added without recompilation (zypper install php5-soap
, yum install php-soap
). If it is not enough, try installing some PEAR class for interpreted SOAP support (NuSOAP, etc.).
In general, the double-dash --switches
are designed to be used when recompiling PHP from scratch.
You would download the PHP source package (as a compressed .tgz
tarball, say), expand it somewhere and then, e.g. under Linux, run the configure script
./configure --prefix ...
The configure
command used by your PHP may be shown with phpinfo()
. Repeating it identical should give you an exact copy of the PHP you now have installed. Adding --enable-soap
will then enable SOAP in addition to everything else.
That said, if you aren't familiar with PHP recompilation, don't do it. It also requires several ancillary libraries that you might, or might not, have available - freetype
, gd
, libjpeg
, XML
, expat
, and so on and so forth (it's not enough they are installed; they must be a developer version, i.e. with headers and so on; in most distributions, having libjpeg
installed might not be enough, and you might need libjpeg-dev
also).
I have to keep a separate virtual machine with everything installed for my recompilation purposes.

- 55,617
- 10
- 65
- 107