Amit Verma
Amit Verma

Reputation: 41219

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.

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.

Is there any other way to get the server version in php?

Thanks!

Upvotes: 0

Views: 2258

Answers (2)

davidethell
davidethell

Reputation: 12018

This Gist provides probably the best fallback I've seen if the apache_get_version function is disabled.

Basically you need to define a function that uses the operating system to call the httpd daemon directly to get the version information. Although, in your situation, it's likely that OS commands are also disabled so this might not be terrible helpful.

Upvotes: 2

Paulius Sapragonas
Paulius Sapragonas

Reputation: 176

if you cannot use php_info and apache_get_version functions you can try this one:
echo $_SERVER['SERVER_SOFTWARE'];

Upvotes: 2

Related Questions