ChatGPT解决这个技术问题 Extra ChatGPT

How do I enable --enable-soap in php on linux?

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?

Did you install php from a pre-made package? Check your distro's respositor and seee if there's a soap package available.
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.
What is your distro? You probably can avoid configuring and compiling PHP from source. There is very likely a package you can install.
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.
The os is Fedora (linux 2.6.27.41-170.2.117.fc10.i686 gnome 2.24.3

g
ghbarratt

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.


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/
dnf install php-soap worked fine today for a 32bit, Fedora 22.
For PHP7: apt-get install php7.0-soap
Running apt-get install php-soap on a Ubuntu 16.04 with PHP7.0 still worked for me.
For PHP 5.6, Need to run this cmd: sudo apt-get install php5.6-soap
N
Noha Salah

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

https://i.stack.imgur.com/uwhrj.png

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.


if you have Ubuntu ver 16.04 in step 2 you can type only:sudo apt install php-soap.
If your PHP is running under FHM, then you may also need sudo service php-fpm restart as I did on AWS
L
LSerni

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.