Check server status php

PHP Server Status script

Where there is high demand for your script you will be endlessly probing the servers (we’ll come back to ‘ping’ later) which is very inefficient at best and could easily be exploited to launch a reflected denial of service attack against the server. There’s a list: Server Load (in real-time, 30ms)

PHP Server Status script

Hey i need help with this server status script. What is happening is when I use this script It doens’t display anything at all.. This is ym current code:

  else < $text = 'Offline'; $color = imagecolorallocate($im, 255,0,0); >/* See if it failed */ if($im) < // Create some colors $white = imagecolorallocate($im, 255, 255, 255); imagefilledrectangle($im, 0, 0, 399, 29, $white); // Replace path by your own font path $font = 'Arial Bold.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $color, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $color, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); >else < print("Error finding image $image
"); > ?>

What I want it do to is Check if a server is online, and if it is then display Online on the background image status.png but when I use the following url format: Myurl/getStatusImage.php?ip=94.249.187.82&port=25565 It displays a blank page.

Congrats fella, it’s time to get acquainted with programming.
And learn some debugging techniques.

In fact, not a soul in the world can tell you what’s wrong with your code, on your server in your environment. But only your own code you can ask for it.

First of all, comment out header line and see what it says.
and — oh — remove all the boody @’s from the code!
so you’ll be able to see if any error occurred.

Then divide your code into 2 chunks — getting info part and creating an image part. Run both separately until each works perfect. And only then combine them up.

Php — Checking if process still running?, The main problem is the if you run a php script, the exec command will be run as the web-servers user (www-data); this user can’t see pid’s from other users, unless you use «pidof»

Get server status with PHP or Javascript?

I have been trying to get a working server status script to work but without any success. There’s a community who runs one themself which looks really cool and i was wondering if anyone could help me out?

I’ve looked over StackOverflow website but seems like most of them doesn’t work.

With PHP, you could use the shell_exec command to effectively ping a specific IP and then determine if it’s online. If the backend is run on Linux, this should work:

$offline = shell_exec(«ping -c 1 8.8.8.8 | grep -c ‘0 received'»);

The above will return 1 if offline, or if the first packet is lost , and 0 if online or the first packet is received . It does not account for packetloss.

Another alternative is to sign up for an actual reliable and redundant service for monitoring, that has an API, and fetch status via that to your site. Depending on your actual needs, this may prove far more reliable.

Читайте также:  Real time graphics python

Polling the state of servers from the script from an on-demand script is usually going to be a very bad idea. Where there is high demand for your script you will be endlessly probing the servers (we’ll come back to ‘ping’ later) which is very inefficient at best and could easily be exploited to launch a reflected denial of service attack against the server. Regardless of the traffic volume, response times will be very slow as each instance polls each server. If a server is unavailable then the situation becomes much worse as you need to wait for a timeout to determine its status (browser use adaptive timeouts for this rather than the OS default).

A better solution is to scheduled probes for checking the status — this is how tools like BMC Patrol and Nagios work for service monitoring.

Regarding the method of polling the service, while its usually true that if you can’t ping a node, then you won’t be able to access the services it should be providing, that does not mean that if you can ping a server you can access its services. Carrying out a TCP handshake on the service socket will give a much more accurate description of whether the service is available. However if you are repeatedly connecting to someone else’s server without exchanging any data, this might be perceived as a denial of service attack by the admins and hence your IP will get black listed. i.e. you should probably be talking to whoever runs the servers (if it’s not yourself).

Probing from javacript is only going to work if the server is talking HTTP. It is possible to infer the state of a port from the time it takes for an error to come back (have a google for ‘portscan javascript’ for some examples) but again the results will not be definitive unless you know how the network and servers are configured.

Linux — How to check the presence of php and apache on, Type aptitude to start the package manager. There you can see which applications are installed. Use / to search for packages. Try searching for apache2 and php5 (or whatever versions you want to use). If they are installed, they should be bold and have an i in front of them. If they are not installed (p in front of the line) and you …

Display server status (on or off) on web page

Curious. I’m starting to broadcast high school football games online, and it uses a program to broadcast the feeds off my computer. However, when I shut the program down or the computer down, the server goes offline and guests won’t be able to access the feeds.

Is there any kind of code out there that I can post onto my website that will indicate to my guests whether the server is on or off? I would figure it would be a simple code, a php script or something that periodically checks to see if a site is on line and then displays ON or OFF.

EDIT: use @fsockopen or you’ll get a Cannot connect to the server warning which you can ignore since that is what you’re actually trying to check.

$ping = @fsockopen('myURL or IP', 80, $errno, $errstr, 10); if (!$ping) // site is down 
'; $URL = 'google.com'; $ping = @fsockopen ($URL, 80, $errno, $errstr, 10); (!$ping) ? $status = $URL.' is down' : $status = $URL.' is up'; echo $status; ?> 
randomurlfortestingpurposes.com is down google.com is up 

Two options here, the first is you can request a response from the remote server and if it doesn’t exist (after some timeout) claim that it’s offline. You can cache this if response times can be slower then the time users will want to wait, or shove this into an AJAX request that can then remove the video player, display the notice, etc. on failure.

Читайте также:  Тег SCRIPT

The other alternative is to check for feed failure and display a server offline message.

You can use the PEAR-Package «NET_Ping» to ping your server.

Php — Check server status and output in HTML, I’m trying to output the status of a server (online/offline) in html. I have a PHP snippet that checks the status of the server but I need the output to be in HTML format so I can use it elsewhere on my website. I’m running wordpress with the tablera plugin, I want to output the status (just online or offline text) in …

Real-time Server Status and Information

Last week, I found an admin panel on wrapbootstrap which contains a Dashboard page. This page was awesome because it was containing some server informations about the load and the status.

  • Server Load (in real-time, 30ms)
  • Disk space usage
  • Bandwidth
  • Memory usage (in real-time)
  • Network usage
  • Uptime (seconds included)
  • System Log
  • OS information
  • CPU usage for each core (real-time)
  • Other CPU information
  • etc.

I know that a lot of this cannot be done using PHP but I’m welling to use Node.js or Python, if someone help me. I’m able to do some using PHP but not these unfortunately.

If someone knows how I can create that, it would be awesome!

Note: I have Ubuntu 12.04 LTS on an EC2 instance.

You can do all of that in php.

You may also want to look at MRTG, Nagios etc too all monitoring and server status stuff

Email — How to check if PHP mail() is enabled?, I need to install a PHP site on a Microsoft server. For some reason the host isn’t allowing the site to send e-mails. The host has sent me a code sample which didn’t work. Is there a way to check if the server allows sending of e-mails through the php mail() function? Code sampleecho «Mail Failed»;>?>If the mail() function exist but mails not going, check if a mail transport agent (MTA)such as sendmail or postfix is installed on your serverFeedback

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A simple script PHP to theck and display web server status

License

truongan/php.server.status

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

Читайте также:  border-style

README.md

A simple PHP script to check and display various web server statuses:

System status viewing

No installation and no database is required.

The first section of the script display connection status of some service running on your system. Simply open the php file and make necessary modificaiton in this region:

 $services[] = array("port" => "80", "service" => "Apache", "ip" => "") ; $services[] = array("port" => "21", "service" => "FTP", "ip" => "") ; $services[] = array("port" => "3306", "service" => "MYSQL", "ip" => "") ; $services[] = array("port" => "22", "service" => "Open SSH", "ip" => "") ; $services[] = array("port" => "9091", "service" => "Transmission", "ip" => "") ; 

You can comment out service that you don’t have or add new service use the similar syntax.

The second section of the script display system load status, uptime, resource usage information and top Resource usage process. You can add or remove the mountpoint you want to check for freep space, look for those lines of code:

/* * The disks array list all mountpoint you wan to check freespace * Display name and path to the moutpoint have to be provide, you can */ $disks[] = array("name" => "local" , "path" => getcwd()) ; // $disks[] = array("name" => "Your disk name" , "path" => '/mount/point/to/that/disk') ; 

The last section of the script display network traffic statistic. Those information is gather by vnstat (http://humdi.net/vnstat/), you will need vnstat installed and properly configured before hand.

You can view various information gather and display by vnstat. The option you pass to vnstat will by specified HTTP GET parameter in your request URL. To view

information, you will request the URL

Источник

How to check your server status using PHP

How to check your server status using PHP

For a website administrator it is very important to determine the status of his web server on a regular basis. Here, I will show you how to check the status of a given web server by using PHP. In order to check the server status we will ping it. Also, we will calculate the time taken by the server to respond. This will give us an idea as to how fast is our server. So let’s get started.

To ping to the server we use fsockopen() function. We jot down the time before and after making the ping by using microtime() function. This enables us to determine the overall time taken by the server to respond to our ping.

Create a new PHP file named server_status.php and add the following code to it:

The working demonstration of the above code is shown below:

Here, we have defined a function named check_server_status(). It initiates a connection to the desired domain and also calculates the time taken to respond by the server in milliseconds. Finally, the function returns this value.

We use a form to obtain the value of the domain name for which the status is to be checked. On submission of the form the status is checked and reported. That’s it! GSUDXE56VJJE

How to create Date Picker dialog for selecting a date in Android

Whenever the user has to input a date, its always a good idea to assist him/her with a widget which allows the user to select a particular day, month and year. By default Android provides a widget named DatePicker which can be incoported

How to create QR code by using Google Chart API in PHP

The full form of QR code is Quick Response code. It is a two dimensional code designed specifically to be read by smartphones. It is a type of matrix barcode. The code represents a picture where black squares of various sizes are arranged in

Источник

Оцените статью