如何在 linux 上的 php 中启用 --enable-soap?

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

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

phplinuxsoapfedora

提问by netrox

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?

问题就这么多。我在 Apache 上安装了 PHP 5.2.9,但无法升级 PHP。有没有办法在 PHP 5.2.9 中启用 SOAP?当 PHP 手册说“要启用 SOAP 支持,请使用 --enable-soap 配置 PHP”时,它根本没有帮助。如何配置?

采纳答案by ghbarratt

Getting SOAP working usually does not require compiling PHP from source. I would recommend trying that only as a last option.

使 SOAP 正常工作通常不需要从源代码编译 PHP。我建议仅将其作为最后的选择尝试。

For good measure, check to see what your phpinfo says, if anything, about SOAP extensions:

为了更好地衡量,请检查您的 phpinfo 关于 SOAP 扩展的说明(如果有的话):

$ php -i | grep -i soap

to ensure that it is the PHP extension that is missing.

以确保缺少的是 PHP 扩展。

Assuming you do not see anything about SOAP in the phpinfo, see what PHP SOAP packages might be available to you.

假设您在 phpinfo 中没有看到有关 SOAP 的任何信息,请查看您可以使用哪些 PHP SOAP 包。

In Ubuntu/Debian you can search with:

在 Ubuntu/Debian 中,您可以搜索:

$ apt-cache search php | grep -i soap

or in RHEL/Fedora you can search with:

或者在 RHEL/Fedora 中,您可以搜索:

$ yum search php | grep -i soap

There are usually two PHP SOAP packages available to you, usually php-soapand php-nusoap. php-soapis typically what you get with configuring PHP with --enable-soap.

通常有两个 PHP SOAP 包可供您使用,通常php-soapphp-nusoap. php-soap通常是使用--enable-soap.

In Ubuntu/Debian you can install with:

在 Ubuntu/Debian 中,您可以安装:

$ sudo apt-get install php-soap

Or in RHEL/Fedora you can install with:

或者在 RHEL/Fedora 中你可以安装:

$ sudo yum install php-soap

After the installation, you might need to place an ini file and restart Apache.

安装后,您可能需要放置一个 ini 文件并重新启动 Apache。

回答by LSerni

As far as your question goes: no, if activating from .iniis 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.).

就您的问题而言:不,如果从 激活.ini还不够并且您无法升级 PHP,那么您无能为力。某些模块(但不是全部)无需重新编译即可添加 ( zypper install php5-soap, yum install php-soap)。如果这还不够,请尝试安装一些 PEAR 类以支持解释型 SOAP(NuSOAP 等)。

In general, the double-dash --switchesare designed to be used when recompiling PHP from scratch.

通常,双破折号--switches设计用于从头开始重新编译 PHP。

You would download the PHP source package (as a compressed .tgztarball, say), expand it somewhere and then, e.g. under Linux, run the configure script

您将下载 PHP 源包(例如,作为压缩的.tgztarball),将其展开到某处,然后,例如在 Linux 下,运行配置脚本

./configure --prefix ...

The configurecommand 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-soapwill then enable SOAP in addition to everything else.

configure您的 PHP 使用的命令可能会显示为phpinfo(). 重复相同的操作应该会给你一个你现在安装的 PHP 的精确副本。--enable-soap除了其他所有内容之外,添加将启用 SOAP。

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 libjpeginstalled might not be enough, and you might need libjpeg-devalso).

也就是说,如果您不熟悉 PHP 重新编译,请不要这样做。它还需要几个您可能有或可能没有可用的辅助库 - freetypegdlibjpegXMLexpat等等(安装它们还不够;它们必须是开发人员版本,即带有标题等;在大多数发行版中,libjpeg安装可能还不够,您可能libjpeg-dev还需要)。

I have to keep a separate virtual machine with everything installed for my recompilation purposes.

为了重新编译,我必须保留一个单独的虚拟机,其中安装了所有东西。

回答by Noha Salah

In case that you have Ubuntu in your machine, the following steps will help you:

如果您的机器中有 Ubuntu,以下步骤将对您有所帮助:

  1. 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 ):
  1. 如果您有soap(客户端/服务器)或没有使用phpinfo(),请首先检查您的php测试文件;并在浏览器中检查结果。如果你有它,它看起来像下图(如果没有,请转到第 2 步):

enter image description here

在此处输入图片说明

  1. Open your terminal and paste: sudo apt-get install php-soap.

  2. Restart your apache2 server in terminal : service apache2 restart.

  3. To check use your php test file again to be seems like mine in step 1.

  1. 打开终端并粘贴:sudo apt-get install php-soap。

  2. 在终端重启你的 apache2 服务器:service apache2 restart。

  3. 要再次检查使用您的 php 测试文件,它似乎与我在第 1 步中的一样。