简体   繁体   English

如何在php中获取Apache版本?

[英]How to get apache version in php?

I know this question has been asked/answered on this site multiple times, But my question is a little diffrent. 我知道这个问题已经在这个网站上被多次询问/回答了,但是我的问题有所不同。 I have already reviewed some of those posts and what I got from there is : 我已经查看了其中的一些帖子,从中得到的是:

 <?Php 
 echo apache_get_version();?> 

I know this function returns the Apache version. 我知道此函数返回Apache版本。

My website is on a free webhost eu5.org where they have disabled both phpinfo() and apache_get_version() And because of this I am not able to know which version I am using. 我的网站位于免费的虚拟主机eu5.org上 ,在该网站上,他们已禁用了phpinfo()apache_get_version() ,因此,我无法知道我使用的版本。

Is there any other way to get the server version in php? 还有其他方法可以在php中获取服务器版本吗?

Thanks! 谢谢!

if you cannot use php_info and apache_get_version functions you can try this one: 如果您不能使用php_infoapache_get_version函数,可以尝试以下一种方法:
echo $_SERVER['SERVER_SOFTWARE'] ; echo $_SERVER['SERVER_SOFTWARE'] ;

This Gist provides probably the best fallback I've seen if the apache_get_version function is disabled. 如果禁用了apache_get_version功能,则本要点可能会提供我所见过的最佳回退。

Basically you need to define a function that uses the operating system to call the httpd daemon directly to get the version information. 基本上,您需要定义一个函数,该函数使用操作系统直接调用httpd守护程序以获取版本信息。 Although, in your situation, it's likely that OS commands are also disabled so this might not be terrible helpful. 尽管在您的情况下,可能还禁用了OS命令,所以这可能对您没有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM