I threw this little script together today when checking why a PHP/Flash/MySQL application has stopped working.
The application itself looks and works fine, but I suspected a firewall block between the web server and database server. Without SSH access to this shared server I had to get inventive.
So I tested that PHP could open a socket on the right port to my server…
The application itself looks and works fine, but I suspected a firewall block between the web server and database server. Without SSH access to this shared server I had to get inventive.
So I tested that PHP could open a socket on the right port to my server…
<?php
$site = "www.google.com";
$port = 80;
$fp = fsockopen($site,$port,$errno,$errstr,10);
if(!$fp) {
echo "Cannot connect to server: $errno - $errstr";
} else {
echo "Connect was successful - no errors on Port ".$port." at ".$site;
fclose($fp);
}
?>