php 如何检查服务器是否能够处理 SOAP 请求
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10749903/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I check whether the server is able to handle SOAP requests
提问by phpqa.in
How can I check whether the server is able to handle SOAP requests at run time ? I need to verify it before my script is executing.
如何检查服务器是否能够在运行时处理 SOAP 请求?我需要在我的脚本执行之前验证它。
回答by Epoc
You can use:
您可以使用:
if (extension_loaded('soap')) {
// Do things
}
回答by SilverNodashi
From SSH you can run:
从 SSH 你可以运行:
php -i | grep Soap
that will return something like:
这将返回如下内容:
Soap Client => enabled
Soap Server => enabled
回答by s.webbandit
In PHP to check whether SOAP enabled or not use built in function class_exists():
在 PHP 中检查是否启用了 SOAP 使用内置函数class_exists():
var_dump(class_exists("SOAPClient"));
var_dump(class_exists("SOAPClient"));
It also could be user to check any of modules classes.
用户也可以检查任何模块类。
回答by Grigoreas P.
in the command line type the following:
在命令行中键入以下内容:
>> php -r 'echo (extension_loaded("soap")?"LOADED\n":"not loaded\n");'
回答by Nicolas Klaudel
Hmm... I'm new and I'm bad : I tried this in a "test.php" file.
嗯...我是新手,我很糟糕:我在“test.php”文件中尝试过这个。
<?php
if (extension_loaded('soap'))
{
echo phpinfo();
}
else //will redirect to sth else so you know it doesn't work
{
header("Location: http://localhost/index.html");
die();
}
?>
And I saw myself looking at a "phpinfo()" page with a paragraph called : "soap".
我看到自己在看一个“phpinfo()”页面,其中有一段叫做:“soap”。
Sorry for the misinterpretation.
对不起,误解。
To install SOAP :
Check your "php.ini" file, look for "extension".
You should find a line :extension=php_soap.dllor ;extension=php_soap.dll
";" means it's commented.
Uncomment it.
If you didn't find the line, then put it there.extension=php_soap.dll
Make sure the dll file actually is in the default folder php/ext.
If it isn't, check on phpinfo() is your version is VC6, VC9 of VC11, go to the php download page : http://windows.php.net/download#php-5.6and get the correspondant version of php zip file.
Steal their "php_soap.dll" from their /ext folder and put it in yours.
You're all set!
Restart your servers, then go to your phpinfo() test page to check if it works.
要安装 SOAP:
检查您的“php.ini”文件,寻找“扩展名”。
你应该找到一行:extension=php_soap.dll或;extension=php_soap.dll
“;” 表示已评论。
取消注释。
如果你没有找到这条线,那就把它放在那里。extension=php_soap.dll
确保 dll 文件实际上位于默认文件夹中php/ext。如果不是,检查phpinfo()是你的版本是VC6,VC11的VC9,到php下载页面:http: //windows.php.net/download#php-5.6获取对应版本的php压缩文件。
从他们的 /ext 文件夹中窃取他们的“php_soap.dll”并将其放入您的文件夹中。
你都准备好了!
重新启动您的服务器,然后转到您的 phpinfo() 测试页面以检查它是否有效。
Good luck.
Note :
phpinfo() simple test.php file :
祝你好运。
注意:phpinfo() 简单的 test.php 文件:
<php
echo phpinfo();
?>
回答by Nico
in a php file :
在一个 php 文件中:
<?php
echo phpinfo();
?>
and then look for SOAP and you will see if SOAP is installed and enabled
然后查找 SOAP,您将看到是否安装并启用了 SOAP
回答by Nicolas Klaudel
PEAR packages are not listed in phpinfo(), so if "soap" doesn't appear on your "test.php" page, it's normal !
PEAR 包没有在 phpinfo() 中列出,所以如果“soap”没有出现在你的“test.php”页面上,这是正常的!
回答by Ray
You can use the phpinfo script to see is SOAP is installed.
您可以使用 phpinfo 脚本查看是否安装了 SOAP。
http://[your-domain.com]/phpinfo.php
http://[your-domain.com]/phpinfo.php

