PHP Server Monitor is a free-ware and web-based monitoring tool that checks for websites and the server status. This allows the users to manage the services using a web interface.
In this tutorial we will teach you how to install PHP Server Monitor in this guide.
Step 1: Installing PHP Server Monitor.
Before you Install the PHP server monitor, begin by installing the package needed.
[root@linuxhelp1 Desktop]# yum install httpd mariadb-server php php-curl php-cli php-mysql php-pdo -y Loaded plugins: fastestmirror, langpacks Determining fastest mirrors * base: centos.excellmedia.net * extras: centos.excellmedia.net * updates: centos.excellmedia.net Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-40.el7.centos.4 will be installed --> Processing Dependency: httpd-tools = 2.4.6-40.el7.centos.4 for package: httpd-2.4.6-40.el7.centos.4.x86_64 --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-40.el7.centos.4.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-40.el7.centos.4.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-40.el7.centos.4.x86_64
Installed:
httpd.x86_64 0:2.4.6-40.el7.centos.4 mariadb-server.x86_64 1:5.5.50-1.el7_2 php.x86_64 0:5.4.16-36.3.el7_2 php-cli.x86_64 0:5.4.16-36.3.el7_2 php-common.x86_64 0:5.4.16-36.3.el7_2 php-mysql.x86_64 0:5.4.16-36.3.el7_2 php-pdo.x86_64 0:5.4.16-36.3.el7_2 Dependency Installed: apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-40.el7.centos.4 libzip.x86_64 0:0.10.1-8.el7 mailcap.noarch 0:2.1.41-2.el7 mariadb.x86_64 1:5.5.50-1.el7_2 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-5.el7 perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 Dependency Updated: mariadb-libs.x86_64 1:5.5.50-1.el7_2
Complete!
Execute the command below in order for the ‘apache’ and ‘mariadb’ services to start.
[root@linuxhelp1 Desktop]# systemctl start mariadb.service [root@linuxhelp1 Desktop]# systemctl start httpd.service
Next we will install ‘mysql’ by using ‘mysql_secure_installation’.
[root@linuxhelp1 Desktop]# mysql_secure_installation /usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! Remove test database and access to it? [Y/n] - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
Step 2: Creating the database and user for ‘phpmonitor’.
Use the command below to create a database for the PHP Server Monitor.
[root@linuxhelp1 Desktop]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 10 Server version: 5.5.50-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]> create database phpmonitor; Query OK, 1 row affected (0.00 sec) Allow “user1” to access the “phpmonitor” database on localhost with password. MariaDB [(none)]> grant all on phpmonitor.* to 'user1'@'localhost' identified by 'linuxc'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye
Go to the apache root folder and download the latest PHP server monitor package.
[root@linuxhelp1 Desktop]# cd /var/www/html/ [root@linuxhelp1 html]# wget http://nchc.dl.sourceforge.net/project/phpservermon/phpservermon/PHP%20Server%20Monitor%20v3.1.1/phpservermon-3.1.1.tar.gz --2016-09-15 06:16:45-- http://nchc.dl.sourceforge.net/project/phpservermon/phpservermon/PHP%20Server%20Monitor%20v3.1.1/phpservermon-3.1.1.tar.gz Resolving nchc.dl.sourceforge.net (nchc.dl.sourceforge.net)... 211.79.60.17, 2001:e10:ffff:1f02::17 Connecting to nchc.dl.sourceforge.net (nchc.dl.sourceforge.net)|211.79.60.17|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1105954 (1.1M) [application/x-gzip] Saving to: ‘phpservermon-3.1.1.tar.gz’ 100%[=================================================================================================>] 11,05,954 312KB/s in 3.5s 2016-09-15 06:16:49 (312 KB/s) - ‘phpservermon-3.1.1.tar.gz’ saved [1105954/1105954]
Execute the command below so PHP Server Monitor extracts, then rename it as shown below:
[root@linuxhelp1 html]# tar -xvzf phpservermon-3.1.1.tar.gz ./phpservermon-3.1.1/ ./phpservermon-3.1.1/install.php ./phpservermon-3.1.1/vendor/ ./phpservermon-3.1.1/vendor/autoload.php ./phpservermon-3.1.1/vendor/twig/ ./phpservermon-3.1.1/static/plugin/twitter-bootstrap/css/ ./phpservermon-3.1.1/static/plugin/twitter-bootstrap/css/bootstrap-responsive.min.css ./phpservermon-3.1.1/static/plugin/twitter-bootstrap/css/bootstrap.css ./phpservermon-3.1.1/static/plugin/twitter-bootstrap/css/bootstrap.min.css ./phpservermon-3.1.1/static/plugin/twitter-bootstrap/css/bootstrap-responsive.css ./phpservermon-3.1.1/static/plugin/twitter-bootstrap/js/ ./phpservermon-3.1.1/static/plugin/twitter-bootstrap/js/bootstrap.min.js ./phpservermon-3.1.1/static/plugin/twitter-bootstrap/js/bootstrap.js ./phpservermon-3.1.1/static/js/ ./phpservermon-3.1.1/static/js/scripts.js ./phpservermon-3.1.1/static/js/history.js ./phpservermon-3.1.1/favicon.png ./phpservermon-3.1.1/cron/ ./phpservermon-3.1.1/cron/status.cron.php [root@linuxhelp1 html]# mv phpservermon-3.1.1 phpservermon
Run the command below so that the ownership of the directory changes.
[root@linuxhelp1 html]# chown -R apache:apache /var/www/html/phpservermon
Open the ‘php.ini’ file to set the time zone as shown below.
[root@linuxhelp1 html]# vim /etc/php.ini [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone =Asia_Kolkata
Open the web browser and go to the URL ‘http://<IP_address>/phpservermon’. Press enter to continue.
Put in your user information and database before clicking on ‘Save Configuration’.
If you receive an error that says ‘Unable to save your configuration’, this means you have to create a configuration file and put in the information shown below.
Execute the command below in order to create ‘config.php’ file inside the ‘phpservermon’ directory.
[root@linuxhelp1 html]# cd phpservermon [root@linuxhelp1 phpservermon]# vi config.php <?php define('PSM_DB_HOST', 'localhost'); define('PSM_DB_NAME', 'phpmonitor'); define('PSM_DB_USER', 'user1'); define('PSM_DB_PASS', 'linuxc'); define('PSM_DB_PREFIX', 'psm_');
Replace the ownership of the file made as shown below.
[root@linuxhelp1 phpservermon]# chown -R apache:apache /var/www/html/phpservermon
Enter your Username and Password before clicking on Install to continue further. N
ow go to your monitor and login to the server monitor with the login credentials.
Once you have logged in, simply navigate to ‘Server’ then ‘Add new’ to add a new label.
Enter in your server information and click on ‘Save’.
Click on the ‘Update’ icon to receive the latest update.
To see the status of the server, click ‘Status’.