PHP Server Monitor is an open-source tool designed for monitoring the status of servers and services. In this tutorial, we will show you how to install PHP Server Monitor on a Fedora Server using Apache web server and MariaDB database.
Before we begin, you will need the following:
First, we need to download PHP Server Monitor on our Fedora Server. To get started, open up the terminal and run the following command.
$ wget https://github.com/phpservermon/phpservermon/releases/download/3.3.2/phpservermon-3.3.2.zip
Once you have downloaded the package, extract it by running this command:
$ unzip phpservermon-3.3.2.zip
After the extraction process is complete, we will move the extracted files to the web server directory /var/www/html/
.
$ mv phpservermon /var/www/html/
To configure the database for PHP Server Monitor, we need to create a new database and a user account that has access to this database. Follow the below steps to create a new database.
First, you need to log in to the MariaDB shell as a root user by running the command below:
$ mysql -u root -p
Enter the MariaDB root password when prompted.
Once you are inside the MariaDB shell, run the following command to create a new database named phpservermon_db
.
CREATE DATABASE phpservermon_db;
Next, we will create a new user account that has access to the phpservermon_db
database. Use the following command to create a new user named phpservermon_user
with a password of your choice:
CREATE USER 'phpservermon_user'@'localhost' IDENTIFIED BY '<your-password>';
We will now grant the new user account privileges to the phpservermon_db
database. Use the following command to grant permissions:
GRANT ALL PRIVILEGES ON phpservermon_db.* TO 'phpservermon_user'@'localhost';
We have now created a new database and a user account that has access to the database. Enter the following command to exit the MariaDB shell:
exit;
Now, head to the /var/www/html/phpservermon/config/
directory, and copy the config.default.php
file to config.php
.
$ cd /var/www/html/phpservermon/config/
$ cp config.default.php config.php
Then, change the permission to the config.php file to make it writable by running:
$ chmod u+w config.php
After that, we need to set up the configuration options. Open the config.php
file by running this command:
$ vim config.php
Next, add the database details and credentials we created earlier. Change the below lines in config.php
with the ones specific to your database.
define('PSM_DB_HOST', 'localhost');
define('PSM_DB_PORT', 3306);
define('PSM_DB_NAME', 'phpservermon_db');
define('PSM_DB_USER', 'phpservermon_user');
define('PSM_DB_PASS', '<your-password>');
PHP Server Monitor requires a cron job to keep checking the server and service statuses. To configure the cron job, open the crontab configuration file by running this command:
$ crontab -e
Add the following line at the end of the file:
*/5 * * * * /usr/bin/php /var/www/html/phpservermon/check.php >/dev/null 2>&1
Save and exit the file.
Now, everything is set up, and you can access the PHP Server Monitor web interface by visiting:
http://your-fedora-server-ipaddress/phpservermon/
You can now log in by leaving the username blank and typing 'password' in the password field.
You have successfully installed PHP Server Monitor on your Fedora Server. You can now add servers and services to monitor, configure alerts, and view dashboards with status details. Happy Monitoring!
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!