dotlinux blog

Installing “PHP Server Monitor” Tool using LEMP or LAMP Stack in Arch Linux

In today's digital age, monitoring the health and performance of your server is crucial. The PHP Server Monitor tool is a great solution for this purpose. In this blog post, we'll guide you through the process of installing it using either the LEMP (Linux, Nginx, MySQL/MariaDB, PHP) or LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack on Arch Linux.

2026-05

Table of Contents#

  1. Prerequisites
  2. Installing LEMP Stack (Optional - if choosing LEMP)
    • Install Nginx
    • Install MariaDB/MySQL
    • Install PHP
  3. Installing LAMP Stack (Optional - if choosing LAMP)
    • Install Apache
    • Install MariaDB/MySQL
    • Install PHP
  4. Installing PHP Server Monitor
    • Download the PHP Server Monitor
    • Configure Database
    • Set up Permissions
    • Configure PHP Server Monitor
  5. Testing the Installation
  6. Conclusion
  7. References

1. Prerequisites#

Before we start, make sure your Arch Linux system is up-to-date. You can update it using the following command:

sudo pacman -Syu

You should also have a basic understanding of the command line and have root or sudo privileges.

2. Installing LEMP Stack (Optional - if choosing LEMP)#

Install Nginx#

Nginx is a high-performance web server. Install it using the command:

sudo pacman -S nginx

After installation, start the Nginx service and enable it to start on boot:

sudo systemctl start nginx
sudo systemctl enable nginx

Install MariaDB/MySQL#

For database management, we'll use MariaDB (a fork of MySQL). Install it with:

sudo pacman -S mariadb

Initialize the MariaDB database:

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Start the MariaDB service and enable it:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure the MariaDB installation (set root password, remove anonymous users, etc.) by running:

sudo mysql_secure_installation

Install PHP#

PHP is needed to run the PHP Server Monitor. Install the necessary PHP packages:

sudo pacman -S php php-fpm php-mysql

Start the PHP-FPM service and enable it:

sudo systemctl start php-fpm
sudo systemctl enable php-fpm

3. Installing LAMP Stack (Optional - if choosing LAMP)#

Install Apache#

Apache is a popular web server. Install it with:

sudo pacman -S apache

Start the Apache service and enable it:

sudo systemctl start httpd
sudo systemctl enable httpd

Install MariaDB/MySQL#

Follow the same steps as in the LEMP stack installation for MariaDB/MySQL (steps 2.2).

Install PHP#

Install PHP packages as in the LEMP stack installation (steps 2.3).

4. Installing PHP Server Monitor#

Download the PHP Server Monitor#

First, create a directory for the PHP Server Monitor. Let's say we create it in /var/www/html/psm:

sudo mkdir -p /var/www/html/psm
sudo chown -R http:http /var/www/html/psm

Download the latest version of PHP Server Monitor from its official website (https://www.phpservermonitor.org/). For example, if it's a tar.gz file:

cd /var/www/html/psm
sudo wget [download link]
sudo tar -xzf [filename].tar.gz

Configure Database#

Log in to the MariaDB/MySQL database as the root user:

mysql -u root -p

Create a new database for PHP Server Monitor (e.g., psm_db):

CREATE DATABASE psm_db;
CREATE USER 'psm_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON psm_db.* TO 'psm_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Set up Permissions#

Make sure the files and directories in the PHP Server Monitor directory have the correct permissions. For example:

sudo chown -R http:http /var/www/html/psm
sudo chmod -R 755 /var/www/html/psm

Configure PHP Server Monitor#

Navigate to the PHP Server Monitor directory (e.g., /var/www/html/psm). Edit the config.php file (you may need to copy it from config.php.dist if it's not already there):

cd /var/www/html/psm
sudo cp config.php.dist config.php
sudo nano config.php

In the config.php file, set the database credentials (username, password, database name, host) that you created earlier. Also, set other configuration options like email settings (if you want to receive alerts via email).

5. Testing the Installation#

Open your web browser and navigate to the PHP Server Monitor URL. If you installed it in /var/www/html/psm, the URL would be http://your_server_ip/psm. You should see the PHP Server Monitor setup wizard. Follow the wizard steps to complete the initial setup (create administrator user, etc.).

6. Conclusion#

Congratulations! You've successfully installed the PHP Server Monitor tool using either the LEMP or LAMP stack on Arch Linux. Now you can use it to monitor your server's health, check website uptime, and receive alerts when something goes wrong.

7. References#