如何在 CentOS 上启用 SOAP

2021-12-24 00:00:00 centos centos7 php soap lamp

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

We have VPS with CentOS. I have installed SOAp using the following command:

$ yum install php-soap

然后我转到 php.ini 文件以取消对 SOAP 扩展的注释.它不在那里,所以我添加了以下行:

Then I went to the php.ini file to uncomment the SOAP extension. It was not there, so I added the following line:

extension=soap.so

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

Then I restarted the server by running

$ service httpd restart

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

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

If I try to install it again, I get following message:

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

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

I tried to reconfigure PHP with following command as well:

$ 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'

有什么帮助吗?

推荐答案

就我的观点而言,首先要在 Centos 中安装soap

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

yum install php-soap


二、查看soap包是否存在


Second, see if the soap package exist or not

yum search php-soap

第三,因此您必须看到您安装的soap包的一些结果,现在在根文件夹中的终端中键入命令以搜索特定路径的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

find -name soap.so

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

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,

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

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

/etc/php.ini

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

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

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

然后保存文件并退出.

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

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

service httpd restart

apachectl restart

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

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

相关文章