php Server Status Help

Status
Not open for further replies.

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
http://www.customcf.smfhelp.com/images/x10free.png

cPanel always is offline

PHP:
// CPANEL Only port 2082

imagettftext($background, 12, 0, 215, 83, $white, 'arial.ttf', "cPanel:");

$fp = @fsockopen('64.92.165.74', 2082, $errno, $errstr, 3);
if (!$fp){
$data = 'Offline';
$color = $red;
} else {
$data = 'Online';
$color = $green;
}
@fclose($fp);
imagettftext($background, 12, 0, 260, 83, $color, 'arial.ttf', $data);
// HTTP Only port 80

//cPanel Only Port 2082

Is there something to add there to make it to work.
 

Jake

Developer
Contributors
Messages
4,057
Reaction score
5
Points
0
more like cpanel is always on, when the server is on cpanel is on so i wouldn't even bother having cpanel down as a service lol
BUT let me check what i used lol, been soo long
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
I use this in JM:

PHP:
<?php
   function checkPort($ipAddress, $port) {
      $handle = @fsockopen($ipAddress, $port, $errno, $errstr, 5);
      if ($handle == false) {
         return false;
      }
      else {
         return true;
      }
   }
?>

PHP:
<?php
   $status =  checkPort('64.92.165.74', 2082);
   if ($status == true) {
      $data = 'Online';
      $color = $green;
   }
   else {
      $data = 'Offline';
      $color = $red;
   }

?>

See if that works for you, I know it does for me. I know they're basically the same things, but hmmm. Try to echo $errno and $errstr also if it's still not working. There are other ways to do it, so if this doesn't work, we can find another way.
 
Last edited:

Jake

Developer
Contributors
Messages
4,057
Reaction score
5
Points
0
figures you'd find it in that jumble of code before i could... lol
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Jake said:
figures you'd find it in that jumble of code before i could... lol

SVN, OOP, and folder already open made it pretty easy, haha. :sleep2:
 
Last edited:

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
on checkport() I get this error

Code:
<br /> <b>Fatal error</b>:  Call to undefined function:  checkport() in <b>/home/customcf/public_html/images/x10free.php</b> on line <b>44</b><br />

Jake said:
more like cpanel is always on, when the server is on cpanel is on so i wouldn't even bother having cpanel down as a service lol

BUT let me check what i used lol, been soo long

umm so if the server is down but cPanel is up, wont they get confused
 
Last edited:

Jake

Developer
Contributors
Messages
4,057
Reaction score
5
Points
0
blong4life said:
Jake said:
more like cpanel is always on, when the server is on cpanel is on so i wouldn't even bother having cpanel down as a service lol

BUT let me check what i used lol, been soo long

umm so if the server is down but cPanel is up, wont they get confused

no i mean just dont put it on the sig... lol but you can if you want i wont stop you

second, dont double post

third, the reason its not working is because you dont have BOTH code snippets he posted in your php file. the first code defines the function checkport() and the second code is just using the function.
 
Last edited:

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Jake said:
no i mean just dont put it on the sig... lol but you can if you want i wont stop you

second, dont double post

third, the reason its not working is because you dont have BOTH code snippets he posted in your php file. the first code defines the function checkport() and the second code is just using the function.

lol

second, my edit button disapeered so i had to make a new post sry:mad:

third, now its always offline damit...this will work but how
 

anhminh

Member
Messages
110
Reaction score
0
Points
16
Why Brandon say "cPanel always is offline"? It is must be online to WORK (never offline)?
 
Status
Not open for further replies.
Top