print " Apache port = " . get_apache_port() . " In use by another program.\n"; } if (!port_in_use(get_apache_port()) && get_apache_tracker() == "free") { print " Apache port = " . get_apache_port() . " Is free to use\n"; } //=== SSL port if (apache_running() && get_apache_tracker() != "free" && ssl_enabled()) { print " Apache SSL port = " . get_apache_ssl_port() . " In use by this server\n"; } if (!apache_running() && get_apache_tracker() != "free" && ssl_enabled()) { print " Apache SSL port = " . get_apache_ssl_port() . " Undefined!\n"; } if (!apache_running() && get_apache_tracker() != "free" && !ssl_enabled()) { print " Apache SSL port = " . get_apache_ssl_port() . " Undefined!\n"; } if (apache_running() && get_apache_tracker() != "free" && !ssl_enabled()) { print " Apache SSL port = " . get_apache_ssl_port() . " SSL Not enabled free to use\n"; } if (port_in_use(get_apache_ssl_port()) && get_apache_tracker() == "free") { print " Apache SSL port = " . get_apache_ssl_port() . " In use by another program.\n"; } if (!port_in_use(get_apache_ssl_port()) && get_apache_tracker() == "free") { print " Apache SSL port = " . get_apache_ssl_port() . " Is free to use\n"; } //=== MySQL port if (mysql_running() && get_mysql_tracker() != "free") { print " MySQL port = " . get_mysql_port() . " In use by this server\n"; } if (!mysql_running() && get_mysql_tracker() != "free") { print " MySQL port = " . get_mysql_port() . " Undefined!\n"; }
} else { // server not running, we have a chance to run as a service if ports are free! // === Port tests ========================================== $failed = false; // Assume ports pass test //=== Apache: $apache_port = get_apache_port(); if (port_in_use($apache_port)) { echo " Apache port = " . $apache_port . " - Failed port already in use!\n"; $failed = true; // Set failed flag } else { echo " Apache port = " . $apache_port . " - OK to run Apache service\n"; } //=== Apache SSL if (ssl_enabled()) { // SSL enabled need to test this port $ssl_port = get_apache_ssl_port(); if (port_in_use($apache_ssl_port)) { echo " Apache port = " . $ssl_port . " - Failed port already in use!\n"; $failed = true; // Set failed flag } else { echo " SSL port = " . $ssl_port . " - OK to run Secure Apache serice\n"; } } else { // SSL not enabled echo " SSL not enabled skipping port test.\n"; } //======================================== END Port test if ($failed || !apache_syntax_check()) {