php 如何在 CentOS 上启用 SOAP

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

How to enable SOAP on CentOS

phpsoapcentoslamp

提问by user3241013

We have VPS with CentOS I have installed soap with following command.

我们有带有 CentOS 的 VPS 我已经使用以下命令安装了soap。

yum install php-soap

Then I went to php.ini to un-comment soap extension. It was not there so, I added my own following line.

然后我去 php.ini 取消对soap扩展的注释。它不在那里,所以我添加了自己的以下行。

extension=soap.so

Then i restart server with following command

然后我使用以下命令重新启动服务器

service httpd restart

But SOAP is still not enabled.as i get Fatal error: Class 'SoapClient' If i try to install it again. I get following message.

但是 SOAP 仍然没有启用。因为我收到致命错误:类 'SoapClient' 如果我尝试再次安装它。我收到以下消息。

Package php-soap-5.3.3-27.el6_5.x86_64 already installed and latest version

I tried to re-configure PHP with following command as well.

我也尝试使用以下命令重新配置 PHP。

php-config '--disable-fileinfo' '--disable-pdo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-libxml' '--enable-sockets' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-curl=/opt/curlssl/' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pic' '--with-zlib' '--with-zlib-dir=/usr' '--enable-soap'

Any help?

有什么帮助吗?

回答by Anil

For my point of view, First thing is to install soap into Centos

在我看来,第一件事是将soap安装到Centos中

yum install php-soap


Second, see if the soap package exist or not


二、查看soap包是否存在

yum search php-soap

third, thus you must see some result of soap package you installed, now type a command in your terminal in the root folder for searching the location of soap for specific path

第三,因此您必须看到安装的soap包的一些结果,现在在根文件夹中的终端中键入命令以搜索soap的位置以获取特定路径

find -name soap.so

fourth, you will see the exact path where its installed/located, simply copy the path and find the php.ini to add the extension path,

第四,您将看到其安装/定位的确切路径,只需复制路径并找到 php.ini 以添加扩展路径,

usually the path of php.ini file in centos 6 is in

通常centos 6中php.ini文件的路径在

/etc/php.ini

fifth, add a line of code from below into php.ini file

五、从下面添加一行代码到php.ini文件中

extension='/usr/lib/php/modules/soap.so'

and then save the file and exit.

然后保存文件并退出。

sixth run apache restart command in Centos. I think there is two command that can restart your apache ( whichever is easier for you )

第六步在Centos中运行apache restart命令。我认为有两个命令可以重新启动你的 apache(以你更容易的为准)

service httpd restart

OR

或者

apachectl restart

Lastly, check phpinfo() output in browser, you should see SOAP section where SOAP CLIENT, SOAP SERVER etc are listed and shown Enabled.

最后,检查浏览器中的 phpinfo() 输出,您应该看到 SOAP 部分,其中列出了 SOAP CLIENT、SOAP SERVER 等并显示为已启用。

回答by Evan Donovan

On CentOS 7, the following works:

在 CentOS 7 上,以下工作:

yum install php-soap

This will automatically create a soap.ini under /etc/php.d.

这将自动在/etc/php.d 下创建一个soap.ini。

The extension itself for me lives in /usr/lib64/php/modules. You can confirm your extension directory by doing:

我的扩展本身位于 /usr/lib64/php/modules 中。您可以通过执行以下操作来确认您的扩展目录:

php -i | grep extension_dir

Once this has been installed, you can simply restart Apache using the new service manager like so:

安装完成后,您可以使用新的服务管理器简单地重新启动 Apache,如下所示:

systemctl restart httpd

Thanks to Matt Browne for the info about /etc/php.d.

感谢 Matt Browne 提供有关 /etc/php.d 的信息。

回答by Mukesh

I installed php-soap to CentOS Linux release 7.1.1503 (Core) using following way.

我使用以下方式将 php-soap 安装到 CentOS Linux 版本 7.1.1503(核心)。

1) yum install php-soap

1) yum 安装 php-soap

================================================================================
 Package              Arch           Version                 Repository    Size
================================================================================
Installing:
 php-soap             x86_64         5.4.16-36.el7_1         base         157 k
Updating for dependencies:
 php                  x86_64         5.4.16-36.el7_1         base         1.4 M
 php-cli              x86_64         5.4.16-36.el7_1         base         2.7 M
 php-common           x86_64         5.4.16-36.el7_1         base         563 k
 php-devel            x86_64         5.4.16-36.el7_1         base         600 k
 php-gd               x86_64         5.4.16-36.el7_1         base         126 k
 php-mbstring         x86_64         5.4.16-36.el7_1         base         503 k
 php-mysql            x86_64         5.4.16-36.el7_1         base          99 k
 php-pdo              x86_64         5.4.16-36.el7_1         base          97 k
 php-xml              x86_64         5.4.16-36.el7_1         base         124 k

Transaction Summary
================================================================================
Install  1 Package
Upgrade             ( 9 Dependent packages)

Total download size: 6.3 M
Is this ok [y/d/N]: y
Downloading packages:
------
------
------

Installed:
  php-soap.x86_64 0:5.4.16-36.el7_1

Dependency Updated:
  php.x86_64 0:5.4.16-36.el7_1          php-cli.x86_64 0:5.4.16-36.el7_1
  php-common.x86_64 0:5.4.16-36.el7_1   php-devel.x86_64 0:5.4.16-36.el7_1
  php-gd.x86_64 0:5.4.16-36.el7_1       php-mbstring.x86_64 0:5.4.16-36.el7_1
  php-mysql.x86_64 0:5.4.16-36.el7_1    php-pdo.x86_64 0:5.4.16-36.el7_1
  php-xml.x86_64 0:5.4.16-36.el7_1

Complete!

2) yum search php-soap

2) yum 搜索 php-soap

============================ N/S matched: php-soap =============================
php-soap.x86_64 : A module for PHP applications that use the SOAP protocol

3) service httpd restart

3)服务httpd重启

To verify run following

验证运行以下

4) php -m | grep -i soap

4) php -m | grep -i 肥皂

soap

肥皂

回答by carmolim

The yum install php-soapcommand will install the Soap module for php 5.x

yum install php-soap命令将为 php 5.x 安装 Soap 模块

For installing the correct version for your environment I recommend to create a file info.phpand put this code: <?php echo phpinfo(); ?>

为了为您的环境安装正确的版本,我建议创建一个文件info.php并放置以下代码:<?php echo phpinfo(); ?>

In the header you'll see the version you're using:

在标题中,您将看到您正在使用的版本:

enter image description here

在此处输入图片说明

Now that you know the correct version you can run this command: yum search php-soap

现在您知道正确的版本,您可以运行以下命令: yum search php-soap

This command will return the avaliable versions:

此命令将返回可用版本:

php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php54-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php55-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php56-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php70-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php71-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php72-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php73-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php74-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
rh-php70-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
rh-php71-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
rh-php72-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol

Now you just need to choose the correct module to your php version.

现在您只需要为您的 php 版本选择正确的模块。

For this example, you should run this command php72-php-soap.x86_64

对于这个例子,你应该运行这个命令 php72-php-soap.x86_64

回答by Ahmad Mobaraki

After hours of searching I think my problem was that command yum install php-soapinstalls the latest version of soap for the latest php version.

经过数小时的搜索,我认为我的问题是该命令yum install php-soap为最新的 php 版本安装了最新版本的soap。

My php version was 7.027, but latest php version is 7.2so I had to search for the right soap version and finaly found it HERE!

我的 php 版本是7.027,但最新的 php 版本是7.2所以我不得不搜索正确的soap版本并最终在这里找到它

yum install rh-php70-php-soap

yum install rh-php70-php-soap

Now php -m | grep -i soapworks, Output: soap

现在php -m | grep -i soap工作,输出:soap

Do not forget to restart httpdservice.

不要忘记重新启动httpd服务。