random1 Posted July 5, 2008 Share Posted July 5, 2008 How can you check the status of: * mySQL * PHP * Apache (web server) * FileZilla (ftp server) * Mercury (mail server) as in "Online" or "Offline" or even the status code (Error 3045: Server cannot start since my.conf is not loaded)? This would be really useful to a lot of people. Link to comment https://forums.phpfreaks.com/topic/113285-php-and-mysql-statuses/ Share on other sites More sharing options...
LooieENG Posted July 5, 2008 Share Posted July 5, 2008 http://yourdomain.com/status/status.php?port=80 (80 = HTTP, change for MySQL, FTP, etc.) status.php <?php if ( !ctype_digit($_GET['port']) ) { exit('gtfo'); } $port = $_GET['port']; $churl = @fsockopen('http://yourdomain.com', $port); if (!$churl) { // Server is offline, do offline stuffs. } else { // Woot, online. do moar stuffs. } ?> Link to comment https://forums.phpfreaks.com/topic/113285-php-and-mysql-statuses/#findComment-582053 Share on other sites More sharing options...
ocpaul20 Posted July 5, 2008 Share Posted July 5, 2008 mySQL * PHP * Apache (web server) * FileZilla (ftp server) * Mercury (mail server) I'll tell you how I do it and then others can give you (and me) a better way. Mysql - you try and connect/open the database and use the return code to see if it is there. PHP - what you are really asking is if it is installed properly, so try phpinfo() to see if it is installed, then try a php program to see if it runs in the browser. Apache - when you installed apache there is a "IT WORKS" page that comes up if you go to http://localhost I think. Filezilla - dont know Mercury - dont know. Link to comment https://forums.phpfreaks.com/topic/113285-php-and-mysql-statuses/#findComment-582103 Share on other sites More sharing options...
bluejay002 Posted July 5, 2008 Share Posted July 5, 2008 well what i do is that: given you have a PHP script that is working and is connecting to the database, run that script, if it cannot connect to the web server then apache is done; if it does but displays your php code, then the PHP parser was not loaded or not present (NOTE: you do not need to run PHP parser at all, Apache will do it for you - as how I understood things); if it runs but cannot connect to the database server, probably the database server is done, probably. but if you have XAMPP (Well, that's what I use during development but I think our production is different), XAMPP will do it for you! show you the status of Apache, MySQL, Filezilla and Mercury. though i havent used Mercury and Filezilla. Link to comment https://forums.phpfreaks.com/topic/113285-php-and-mysql-statuses/#findComment-582117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.