random1 Posted November 10, 2010 Share Posted November 10, 2010 How to reliably determine if server is Apache using PHP? For example isApache() function? Link to comment https://forums.phpfreaks.com/topic/218256-how-to-reliably-determine-if-server-is-apache/ Share on other sites More sharing options...
radar Posted November 10, 2010 Share Posted November 10, 2010 You could always try using: $version = apache_get_version(); I haven't used it myself, but it appears as though it'd work for you. Who knows if it'll throw errors if the server isnt running apache though. Link to comment https://forums.phpfreaks.com/topic/218256-how-to-reliably-determine-if-server-is-apache/#findComment-1132511 Share on other sites More sharing options...
requinix Posted November 10, 2010 Share Posted November 10, 2010 If PHP is running as an Apache module then you can use if (function_exists("apache_get_version") && strncmp(apache_get_version(), "Apache", 6) == 0) { If it's running as CGI... there might be something in $_SERVER or $_ENV, but I don't think you could rely on it. Wondering why you're checking for this... Link to comment https://forums.phpfreaks.com/topic/218256-how-to-reliably-determine-if-server-is-apache/#findComment-1132514 Share on other sites More sharing options...
random1 Posted November 10, 2010 Author Share Posted November 10, 2010 Thanks all... I will be using this function to determine Apache during a setup script Link to comment https://forums.phpfreaks.com/topic/218256-how-to-reliably-determine-if-server-is-apache/#findComment-1132562 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.