# Monitor Websites, Servers and Other Network Service Uptime with PHP Server Monitor

## What is PHP Server Monitor?

PHP Server Monitor is a script that checks whether your websites and servers are up and running. It comes with a web based user interface where you can manage your services and websites, and you can manage users for each server with a mobile number and email address. - https://www.phpservermonitor.org/

## Installation

1. Log into the Linux device
2. Run the following commands in a terminal:
   # update software repositories
   sudo apt update
   # install software updates
   sudo apt upgrade -y
   # install Apache HTTPD and MySQL
   sudo apt install apache2 mariadb-server mariadb-client -y
   # install PHP components
   sudo apt install php7.3 libapache2-mod-php7.3 php7.3-curl php7.3-common php7.3-json php7.3-mysql php7.3-xml
   # configure the MySQL database
   sudo su
   mysql_secure_installation
3. Press Enter to login as root
4. Type Y and press Enter to set a root password, type the password twice to confirm
5. Type Y and press Enter to remove anonymous users
6. Type Y and press Enter to disallow root login remotely
7. Type Y and press Enter to remove the test database
8. Type Y and press Enter to reload privilege tables
9. Run the following command to login into MySQL:
   mysql -u root -p
10. Authenticate with the root password set earlier
11. Run the following commands to create the database and database user
    CREATE DATABASE server_monitor;
    GRANT ALL ON server_monitor.* to 'servermon_rw'@'localhost' IDENTIFIED BY '$erv3rM0n!';
    FLUSH PRIVILEGES;
    EXIT;
    exit
12. Continue with the following commands to download and extract PHP Server Monitor in the Apache webroot
    # download latest PHP Server Monitor
    wget -O phpservermon.tar.gz https://github.com/phpservermon/phpservermon/releases/download/v3.5.2/phpservermon-3.5.2.tar.gz
    # extract the tar.gz
    sudo tar xzvf phpservermon.tar.gz --directory /var/www/html
    # rename the extracted folder
    sudo mv /var/www/html/phpservermon-3.5.2 /var/www/html/monitor
    # create config.php placeholder
    sudo touch /var/www/html/monitor/config.php
    # set the owner of the new monitor directory to www-data
    sudo chown -R www-data:www-data /var/www/html/monitor
    # set the PHP timezone, change the timezone as needed before running
    sudo sed -i "s/^;date.timezone =/\date.timezone = America\/New_York/" /etc/php/7.3/apache2/php.ini
    # restart apache2 service for the changes to take effect
    sudo systemctl restart apache2
13. Open a web browser and navigate to http://DNSorIP/monitor/install.php
14. The PHP Server Monitor setup screen should be displayed
15. Click the Let's Go button
16. Fill out the database connetion information as follows

    Database host: localhost
    Database port: 3306
    Database name: server_monitor
    Database user: servermon_rw
    Database password: $erv3rM0n!
    Table prefix:

17. Click Save configuration
18. Refresh the page
19. Create an administrator account by entering a username, password and email address > Click Install
20. After the installation completes click Go to your monitor
21. Login with the administator account created earlier
22. Welcome to PHP Server Monitor

Source: https://github.com/phpservermon/phpservermon