PHP Server Monitor - Windows Setup Guide - IT Imagination
PHP Server Monitor - Windows Setup Guide - IT Imagination
IT Imagination
Adventuring through a world of fun and an ocean of pain. A day in the life of a sysadmin.
Want to use PHP Server Monitor to track the uptime status of your devices? Not ready
to build a CentOS or Ubuntu Server instance, but would rather have a Windows-
install?
This will be focusing on the Windows Desktop option. It’s lower performance than
Linux or IIS, but it sure is easier for beginners, and easier to move between hosts.
Win10 + XAMPP
https://itimagination.com/php-server-monitor-windows-setup-guide/ 1/9
12/21/21, 4:39 PM PHP Server Monitor - Windows Setup Guide - IT Imagination
This tool has been around for many, many years. The code base made be old, but it’s
free, still updated, and very reliable.
https://www.apachefriends.org/index.html
Go snag XAMPP (32 Bit only for Windows). There is also a portable version if you don’t
want a permanent install (e.g. run off a thumb-drive).
Run the installer, it is recommended to not install to Program Files directories due to
weird permissions with UAC. Recommend installing to root, e.g. C:\XAMPP.
Download PHPServerMonitor
Go to C:\xampp\htdocs, copy the contents to C:\xampp\htdocs.old, create the
directory if it does not exist.
Unzip the ZIP contents into your operating PHP directory, by default: C:\xampp\htdocs
https://itimagination.com/php-server-monitor-windows-setup-guide/ 2/9
12/21/21, 4:39 PM PHP Server Monitor - Windows Setup Guide - IT Imagination
Download Composer
Composer is a dependency packager — it downloads and auto-installs the pieces that
PHP Server Monitor depends on.
https://getcomposer.org/download/
The installer will add the composer.exe file into your Windows environment path,
allowing you to run it from command line in any directory. The installer should also
auto-detect your xampp install, and the operating directory of C:\xamp\htdocs.
When the command “composer install” is run, it will look for a .JSON file inside the
directory it is being run. This contains the instructions of what composer needs to do.
https://itimagination.com/php-server-monitor-windows-setup-guide/ 3/9
12/21/21, 4:39 PM PHP Server Monitor - Windows Setup Guide - IT Imagination
1. mysql -u root -p
2. [Password is blank, just hit enter]
3.
4. create database phpsrvmon;
5. #Change your user and password in quotes
6. create user phpsrvmon_user@localhost identified by "user_password";
7. #Make this match the user above
8. grant all privileges on phpsrvmon.* to phpsrvmon_user@localhost;
9. flush privileges;
10. quit
https://itimagination.com/php-server-monitor-windows-setup-guide/ 4/9
12/21/21, 4:39 PM PHP Server Monitor - Windows Setup Guide - IT Imagination
Save Configuration
https://itimagination.com/php-server-monitor-windows-setup-guide/ 5/9
12/21/21, 4:39 PM PHP Server Monitor - Windows Setup Guide - IT Imagination
You may get an error, “Unable to save your configuration”. It should cough out the code
you can copy/paste into a config.php file.
If so, open your config.php file, and overwrite the code with what it provided. If you
don’t have it, it looks like this:
1. <?php
2. define('PSM_DB_HOST', 'localhost');
3. define('PSM_DB_PORT', '3306');
4. define('PSM_DB_NAME', 'phpsrvmon');
5. define('PSM_DB_USER', 'phpsrvmon_user');
6. define('PSM_DB_PASS', 'your password');
7. define('PSM_DB_PREFIX', 'psm_');
8. define('PSM_DB_BASEURL', 'http://something.yourdomain.com');
Save the file config.php, go back to XAMPP, and stop/start Apache to load in the new
settings.
You should get the message, “Sweet, your database connection is up and running!”
Now create a username, password, and email — this is for actually using the website,
nothing to do with the database infrastructure.
Create a Monitor
Login to your site, it will redirect to your web-URL by the way, so ensure it can be
resolved by your DNS server. If you’re desperate, you can always edit the Windows
HOSTS file.
https://itimagination.com/php-server-monitor-windows-setup-guide/ 6/9
12/21/21, 4:39 PM PHP Server Monitor - Windows Setup Guide - IT Imagination
Add New (+) > Add a DNS address or IP, select a ping, or a matching service/port. It is
important to set a threshold, I typically use a Warning Threshold of 2, meaning after 1
query it is a warning (amber), after 2 it is an alert (red). I use a timeout of 10 seconds
usually, just in-case latency is high. Check off the users you want to be able to view the
monitor.
https://itimagination.com/php-server-monitor-windows-setup-guide/ 7/9
12/21/21, 4:39 PM PHP Server Monitor - Windows Setup Guide - IT Imagination
https://itimagination.com/php-server-monitor-windows-setup-guide/ 8/9
12/21/21, 4:39 PM PHP Server Monitor - Windows Setup Guide - IT Imagination
While in XAMPP, configure the services to autostart on boot. Click: Config > Check:
Apache, MySQL
There will be a comment in front of it ” ; “, remove the semicolon to make the code
active, save php.ini. Go back to XAMPP, and stop/start Apache.
Now get those monitors added, and keep and eye on all your important gear. Good
luck!
https://itimagination.com/php-server-monitor-windows-setup-guide/ 9/9