如何在CentOS上启用SOAP

use*_*013 35 php lamp soap centos

我们有CentOS的VPS我用以下命令安装了soap.

yum install php-soap
Run Code Online (Sandbox Code Playgroud)

然后我去php.ini取消评论soap扩展.它不存在,我添加了自己的以下行.

extension=soap.so
Run Code Online (Sandbox Code Playgroud)

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

service httpd restart
Run Code Online (Sandbox Code Playgroud)

但SOAP仍未启用.因为我得到致命错误:类'SoapClient'如果我尝试再次安装它.我得到以下信息.

Package php-soap-5.3.3-27.el6_5.x86_64 already installed and latest version
Run Code Online (Sandbox Code Playgroud)

我尝试使用以下命令重新配置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'
Run Code Online (Sandbox Code Playgroud)

有帮助吗?

Ani*_*nil 44

对于我的观点,首先要在Centos中安装soap

yum install php-soap
Run Code Online (Sandbox Code Playgroud)


其次,看看肥皂包是否存在

yum search php-soap
Run Code Online (Sandbox Code Playgroud)

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

find -name soap.so
Run Code Online (Sandbox Code Playgroud)

第四,你会看到它安装/位置的确切路径,只需复制路径并找到php.ini来添加扩展路径,

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

/etc/php.ini
Run Code Online (Sandbox Code Playgroud)

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

extension='/usr/lib/php/modules/soap.so'
Run Code Online (Sandbox Code Playgroud)

然后保存文件并退出.

Centos中的第六次运行apache restart命令.我认为有两个命令可以重启你的apache(对你来说更容易)

service httpd restart
Run Code Online (Sandbox Code Playgroud)

要么

apachectl restart
Run Code Online (Sandbox Code Playgroud)

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

  • 在最新版本的CentOS中,扩展的PHP配置位于/etc/php.d中,每个扩展名都有一个单独的.ini文件.但在我的情况下,在我运行yum install php-soap之后,我所要做的就是重新启动Apache; soap.ini文件已经存在. (6认同)

Eva*_*van 12

在CentOS 7上,以下工作:

yum install php-soap
Run Code Online (Sandbox Code Playgroud)

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

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

php -i | grep extension_dir
Run Code Online (Sandbox Code Playgroud)

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

systemctl restart httpd
Run Code Online (Sandbox Code Playgroud)

感谢Matt Browne关于/etc/php.d的信息.

  • 我试过这个.但我尝试安装php-soap时出错,所以我搜索并找到了这个:[http://stackoverflow.com/questions/23919341/error-php55w-common-conflicts-with-php-common-on-centos-6 -5](http://stackoverflow.com/questions/23919341/error-php55w-common-conflicts-with-php-common-on-centos-6-5)长话短说.这解决了我的问题:`yum install php55w-soap` (2认同)

Muk*_*esh 5

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

1)百胜安装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!
Run Code Online (Sandbox Code Playgroud)

2)百胜搜索php-soap

============================ N/S matched: php-soap =============================
php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
Run Code Online (Sandbox Code Playgroud)

3)服务httpd重启

验证以下运行

4)php -m | grep -i肥皂

肥皂


car*_*lim 5

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

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

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

在此处输入图片说明

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

此命令将返回可用版本:

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
Run Code Online (Sandbox Code Playgroud)

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

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