PHP based PPP manager

From MikroTik Wiki
Jump to navigation Jump to search


I was working on creating a very simple PHP based Mikrotik Panel for administration of PPP Secrets. I have created many functions which are working fine for the administration of PPP Secrets.

Here I will share those PHP Scripts and will also let you all know how to make them work.

The main thing of these scripts is that you do not require any SSH-Keys or Password less login to make it work. I have used a very extensive SSH library for PHP which I found over internet. Now you only have to create a user on Mikrotik and set credentials for that user in PHP file and that will work.

This script also maintains a MySQL Database with the information of users. So it will become very easy for any one to make a custom report based on their criteria.

I would like to request all that please preserve the Footer as that is the only part where I have mentioned My name as the developer.

You are free to modify or alter any other part of any of the scripts.

Currently following features are present in these scripts, more will be added if I get time.

  • Creating New User ( PPP->Secret + MySQL ).
  • Searching User ( this is only from MySQL ).
  • Show a list of all users ( PPP -> Secret ).
  • Delete User ( PPP->Secret + MySQL ).
  • Enable User ( PPP->Secret ).
  • Disable User ( PPP-> Secret ).
  • Change User Password ( PPP->Secret + MySQL), while changing old password is required.
  • Live Monitor Online Users ( PPP->Active Connections ).
  • Show User Stats ( Show Online Users Stats from Queue->Simple ).
  • Monitor Specific Users Stats.

It has a very simple look, which you can edit by creating your own custom CSS.

ZIP File for download is available at [1]



Please download the ZIP file attached in the forum post at [2]

Unzip the file and upload all the files to the Linux Server with LAMP environment.

You will need following credentials. 1. UserName and Password of MySQL SuperUser. 2. UserName, Password and Port for Mikrotik SSH.

Once you have uploaded files to Linux Server, now open Shell prompt of Linux server using your favorite SSH client ( I use Putty ).

I will assume that you have uploaded all files at "/var/www/mtpanel".

Now execute following commands

shell#cd /var/www/mtpanel
shell#mysql -u <username> -p<password>
mysql#create database mtpanel;
mysql#grant all on mtpanel.* to 'mtpanel'@'localhost' identified by 'mtpanel';
mysql#flush privileges;
mysql#use mtpanle;
mysql#\. /var/www/mtpanel/mtpanel.sql;

Now MySQL database has been created and users table also has been imported to that database.

Now we will configure MT Panel to work with this Database and Mirktoik.

shell#cd /var/www/mtpanle/inc

In this directory there are two files 1. conf.php 2. dbconnect.php

Edit conf.php Open conf.php in your favorite file editor and make necessary changes. Here you will have to define the SSH Username, Password, Mikrotik IP and Port that will be used to query Mikrotik Router using SSH protocol.

Edit dbconnect.php Open dbconnect.php in your favorite file editor. Set the credentials that will be used to connect to the MySQL database. If you have followed above commands then you will not need to change anything in this file.

Once you have completed all the steps. Now its time to test the MT Panel.

Go to your favorite web browser and browse to


You should see a similar page as shown in above snapshot. If you see errors please post them to the forum post from where you downloaded the zip file.

Note:Initially your database will not be synced to the User list in Mikrotik. I am creating a Bash script to sync the users from Mikrotik PPP->Secrets section with the MySQL database that is being used by the MT Panle

Article by Mudasir Mirza. All scripts are my own creation and I have not copied any material from anywhere.