Jump to content

PHP and MySQL statuses?


random1

Recommended Posts

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.
}

?>

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.

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. :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.