PHP脚本找到Web服务器名称 [英] php script to find web server name
问题描述
是否有任何PHP脚本找到像Apache,清漆,Nginx的,等Web服务器的名称。
Is there any php script to find the name of the web server like apache, varnish, nginx, etc.
我知道的Netcraft和wappalyzer,但我想有一个脚本在我的本地机器上运行
I know about netcraft and wappalyzer, but I want to have a script to run in my local machine
主要的原因是,我有4台服务器在我的本地机器的Apache2,nginx的,上光油和莱蒂。
The main reason is, I have 4 servers in my local machine Apache2, nginx, Varnish and Lighty.
我对他们有不同的端口像本地主机:70本地主机:7070等,但所有的服务器根目录是/ var / WWW /我必须是/ www 1 index.php文件列出在/ www文件夹中的所有项目。
I have different ports for them like localhost:70 localhost:7070 etc. But all the servers root folder is /var/www/ and I have one index.php in /www which lists all the projects under /www folder.
我需要一些PHP脚本呼应的服务器名称在我的index.php文件,例如插入:如果我使用localhost:70脚本将检测其Apache和显示Apache的,等等。
I need some php script to echo the server name to insert in my index.php file, eg: if I use localhost:70 the script would detect its Apache and will display Apache, so on.
推荐答案
您可以使用 $ _ SERVER
方法在PHP中获取服务器信息。
You can get the server information using $_SERVER
method in php.
$ _ SERVER ['软件']
返回名称例如的Apache / 2.2.21(的Win32)PHP / 5.3.10
这篇关于PHP脚本找到Web服务器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!