<?php
// check function apache_get_modules
if (function_exists('apache_get_modules')) {
    $modules = apache_get_modules();
    if (in_array('mod_proxy', $modules)) {
        echo "mod_proxy enabled";
    } else {
        echo "mod_proxy disabled.";
    }
} else {
    // alternative method
    $headers = get_headers('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 1);
    if (isset($headers['Via']) || isset($headers['Proxy-Connection'])) {
        echo "enabled, found proxy headers";
    } else {
        echo "no apache_get_modules() PHP over CGI/FastCGI";
}
?>
