我们有CentOS的VPS 我用以下命令安装了肥皂。
yum install php-soap
然后我去php.ini取消评论soap扩展。它不存在,我添加了我自己的后续行。
extension=soap.so
然后我用以下命令重新启动服务器
service httpd restart
但仍然没有启用SOAP。因为我收到致命错误:类'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'
任何帮助?
答案 0 :(得分:41)
就我而言,首先是将肥皂安装到Centos中
yum install php-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
OR
apachectl restart
最后,检查浏览器中的phpinfo()输出,您应该看到SOAP部分,其中列出了SOAP CLIENT,SOAP SERVER等并显示为Enabled。
答案 1 :(得分:12)
在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。
的信息答案 2 :(得分:4)
我使用以下方式将php-soap安装到CentOS Linux版本7.1.1503(Core)。
1)yum install 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)service httpd restart
验证以下运行
4)php -m | grep -i soap
皂
答案 3 :(得分:1)
经过数小时的搜索,我认为我的问题是命令yum install php-soap
为最新的php版本安装了最新版本的soap。
我的php版本是7.027
,但是最新的php版本是7.2
,所以我不得不搜索正确的soap版本并最终找到了HERE!
yum install rh-php70-php-soap
现在php -m | grep -i soap
有效,输出:soap
不要忘记重启httpd
服务。
答案 4 :(得分:0)
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