[英]How to enable SOAP on CentOS
我们有 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'
有什么帮助吗?
在我看来,第一件事是将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 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 的信息。
我使用以下方式将 php-soap 安装到 CentOS Linux 版本 7.1.1503(核心)。
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 肥皂
肥皂
yum install php-soap
命令将为 php 5.x 安装 Soap 模块
为了为您的环境安装正确的版本,我建议创建一个文件info.php
并放置以下代码: <?php echo phpinfo(); ?>
<?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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.