// not a service print " Apache currently running as a standard program.\n"; // inform user } if (apache_running() && get_apache_tracker() == 'service') { // Server running as a service echo " Stopping {$us_apache_service_name} Service ...\n"; // Inform user stop_apache_service(); echo " UnInstalling Apache Service {$us_apache_service_name} ...\n"; // Inform user uninstall_apache_service(); // And set tracker to free $no_apache_service = false; } if (!apache_running() && get_apache_tracker() == 'service') { // Server running as a service echo " Apache service {$us_apache_service_name} was not running\n"; // Inform user echo " UnInstalling Apache Service {$us_apache_service_name} ...\n"; uninstall_apache_service(); // And set tracker to free $no_apache_service = false; } if ($no_apache_service) { print " Apache is not installed as a service\n"; } } else { //User has not enabled this in config.inc.php print " Apache service not enabled in config.inc.php\n"; }
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"; }
function start_apache() { // Global variables for paths and files global $us_apache_bin; global $usf_uniserv; global $usf_apache_cnf; global $us_apache; $Apache_exe = get_apache_exe(); // Build command line $cmd1 = "start "; $cmd2 = "{$usf_uniserv} \""; $cmd3 = "{$us_apache_bin}/{$Apache_exe} -f "; $cmd4 = "{$usf_apache_cnf} -d "; $cmd5 = "{$us_apache}\""; $cmd = $cmd1 . $cmd2 . $cmd3 . $cmd4 . $cmd5; exec($cmd, $dummy, $return); // Run Apache server set_apache_tracker('program'); // Set tracker to 'program' Prevents // a user installing as a service. $safety_timer = 0; // Set timer while (!apache_running()) { // Check Apache started if ($safety_timer == 40) { // Has safety time been reached break; } $safety_timer = $safety_timer + 1; // update timer usleep(500000); // delay 0.5 sec and repeat } }
} // end else } //end // server not running } else { //User has not enabled this in config.inc.php print " MySQL service not enabled in config.inc.php\n"; print " Or disabled by a user parameter\n"; } // ================================================== END RUN MYSQL SERVICE === print "\n"; // == RUN APACHE SERVICE ===================================================== if ((int) $server_operation & 1) { // Server enabled by config or parameter // === Check server running if (apache_running() && file_exists($usf_apache_pid)) { if (get_apache_tracker() == 'program') { // Server running as a standard program print " Unable to install Apache service!\n Apache Server is running as a standard program.\n"; } if (get_apache_tracker() == 'service') { // Server running as a service print " Apache Server already installed as a service.\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();
// end else } // end Free to run server } // END Not running as a service } else { print " Note:\n"; print " Apache Server not enabled in config.inc.php\n"; print " Or disabled by a user parameter\n"; } // ================================================== END RUN APACHE SERVER === print "\n"; // === RUN CRON =============================================================== if ((int) $server_operation & 16) { // Cron enabled by config or parameter if (apache_running()) { // Only run cron if Apache running // otherwise ignore and exit quietly if (get_cron_tracker() == "run") { // Cron already running print " Cron already running\n"; // Already running, give up } else { // not running set_cron_tracker("run"); // set tracker to run print " Cron started \n"; // inform user // Test switch between the two: visibe //$cmd = 'start ..\..\usr\local\php\php.exe run_cron.php'; // Test // Test switch between the two: hidden