【问题标题】:How to enable SOAP on CentOS如何在 CentOS 上启用 SOAP
【发布时间】:2014-04-30 22:26:16
【问题描述】:

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

$ yum install php-soap

然后我去php.ini 文件取消注释SOAP 扩展。它不存在,所以我添加了以下行:

extension=soap.so

然后我通过运行重新启动服务器

$ service httpd restart

但 SOAP 仍未启用。 我收到了Fatal error: Class 'SoapClient' 消息。

如果我尝试再次安装它,我会收到以下消息:

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

我也尝试使用以下命令重新配置 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'

有什么帮助吗?

【问题讨论】:

  • 我还必须重新启动我的 FastCGI 服务。因为我用的是nginx,所以相关命令是sudo systemctl restart php-fpm

标签: php soap centos centos7 lamp


【解决方案1】:

就我的观点而言,首先是将soap安装到Centos

yum install php-soap


二、查看soap包是否存在

yum search php-soap

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

find -name soap.so

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

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

/etc/php.ini

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

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

然后保存文件并退出。

在 Centos 中第六次运行 apache restart 命令。我认为有两个命令可以重新启动您的 apache(哪个对您来说更容易)

service httpd restart

apachectl restart

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

【讨论】:

  • 在最近的 CentOS 版本中,扩展的 PHP 配置位于 /etc/php.d 中,每个扩展都有一个单独的 .ini 文件。但就我而言,运行 yum install php-soap 后,我所要做的就是重新启动 Apache; soap.ini 文件已经在那里了。
  • @Anil 在运行此命令后 find -name soap.so 在根文件夹中我看到这是肥皂路径 ./usr/lib64/php/modules/soap.so 我在我的扩展中设置了这一行= './usr/lib64/php/modules/soap.so' /etc/php.ini 文件并在cent os 6中重新启动httpd服务。但它仍然无法启用soap服务。有什么想法吗?
  • @mattBrowne 对我来说重新启动 apache 并没有帮助我不得不重新启动 php-fpm 服务。
【解决方案2】:

在 CentOS 7 上,以下工作:

yum install php-soap

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

对我来说,扩展本身位于 /usr/lib64/php/modules 中。您可以通过以下方式确认您的扩展目录:

php -i | grep extension_dir

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

systemctl restart httpd

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

【讨论】:

【解决方案3】:

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

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 搜索 php-soap

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

3) 服务 httpd 重启

验证运行以下

4) php -m | grep -i 肥皂

肥皂

【讨论】:

  • 在根文件夹中运行此命令find -name soap.so 后,我看到这是肥皂路径./usr/lib64/php/modules/soap.so 我设置此行extension='./usr/lib64/php/modules/soap.so' /etc/php.ini 文件并在cent os 6 中重新启动httpd 服务。但仍然如此无法启用肥皂服务。有什么想法吗?
  • 我需要帮助。安装soap是否还会升级其他依赖版本??它显示的显示与您上面描述的相同。
  • @MunishChechi 我不这么认为,但可能是为了兼容性,您可能需要升级其他依赖项。
【解决方案4】:

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

我的 php 版本是 7.027,但最新的 php 版本是 7.2,所以我必须搜索正确的肥皂版本并最终找到它 HERE!

yum install rh-php70-php-soap

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

别忘了重启httpd服务。

【讨论】:

    【解决方案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
    

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

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

    【讨论】:

      猜你喜欢
      • 2015-06-24
      • 1970-01-01
      • 2012-07-20
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-25
      相关资源
      最近更新 更多