/m
PHPNuxBill Installation & Configuration Guide
Prepare Server
Install MySQL, PHP and Apache2
sudo apt update && sudo apt upgrade -y sudo apt install -y apache2 sudo apt install -y mariadb-server mariadb-client sudo apt install -y php php-mysqli php-pdo php-gd php-curl php-mysql |
---|
Download latest from, unzip and transfer to server: https://github.com/hotspotbilling/phpnuxbill/archive/refs/heads/master.zip
Or directly on server:
Unzip and move contents to default Apache2 directory (and remove default index file):
sudo apt install unzip unzip master.zip sudo mv phpnuxbill-master/* /var/www/html/ sudo rm /var/www/html/index.html |
---|
PHPMyAdmin and Database Installation
Add a global (root) MySQL User:
User: master Password: f!rstShip68
sudo mysql -u root -p (enter ubuntu user password) CREATE USER ‘master’@’localhost’ IDENTIFIED BY ‘f!rstShip68’; GRANT ALL PRIVILEGES ON *.* TO ‘master’@’localhost’ WITH GRANT OPTION; FLUSH PRIVILEGES; quit |
---|
Install PHPMyAdmin for ease of Database configuration
sudo apt install -y phpmyadmin |
---|
NB During install select apache2 as the webserver
Create PHPNuxBill blank DB and User:
Log into PHPMyAdmin via http://<server ip>/phpmyadmin and go to User accounts and add a new one. Slect a Username and Password and check the boxes to Create database with same name and grant all privilages and Grant all privileges on wildcard name

Copy the SQL tables for PHPNuxBill and Radius by using the Global User (master) created earlier:
mysql -u master -p phpnuxbill < /var/www/html/install/phpnuxbill.sql mysql -u master -p phpnuxbill < /var/www/html/install/radius.sql |
---|
The DB PHPNuxBill will now be populated with all the relevant tables

PHPNuxBill Configuration
Copy sample Config file and rename it:
sudo cp /var/www/html/config.sample.php /var/www/html/config.php |
---|
Then edit it:
sudo nano /var/www/html/config.php |
---|
Update the Database Settings:
User: phpnuxbill
Password: LfvGD53/7z@45AZ@
DB Name: phpnuxbill
$db_host = “localhost”; # Database Host $db_port = “”; # Database Port. Keep it blank if you are un sure. $db_user = “phpnuxbill”; # Database Username $db_pass = “LfvGD53/7z@45AZ@”; # Database Password $db_name = “phpnuxbill”; # Database Name |
---|

Now set the Apapche2 user to own all files:
sudo chown -R www-data:www-data /var/www/html |
---|
Add Cronjob
cron -e (select 1 for nano) 0 */4 * * * cd /var/www/html/system/ && php -f cron.php |
---|

PHPNuxBill GUI
Access via: http://<server IP>/admin
Default Username/Password = admin / admin

Add the MikroTik device
Add Name, IP address and Username and password for the MikroTik (or a dedicated user account added to System > Users on the MikroTik)
NB. Test you can ping and even SSH to the MikroTik from the Server CLI before doing this step to confirm you have access

Once added click Cek Now to enable Online Checking

Now added your MikroTik as a Radius Client (nas)
Go to PHPMyAdmin and click on the nas table

Then click Insert

Add:
Nasname: IP or resolvable Hostname of MikroTik
Shortname: Identifiable name for the MikroTik
Secret: Needs to match on the MikroTik
Routers: This is the Route Name / Location set on the PHPNuxBill Routers section

MikroTik Configuration
Radius Client
Now on the MikroTik go to Radius and add
Select ppp and hotspot, add the address of the PHPNuxBill server, Secret set on the nas table

Hotspot Setup
IP > Hotspot, click Hotspot Setup

Select the Guest SSID network

Confirm IP of VLAN interface

Specify IP pool to give to clients

Select certificate (none)

Ignore this section

Just IP of interface

Ignore this step

Ignore this step

Confirmation

Login Redirect
Download hotspot/login.html file

Replace it with this. Replace the IP address with IP of PHPNuxBill server
$(if error) <meta http-equiv=”refresh” content=”0; url=$(link-orig)&msg=$(error)&nux-key=$(chap-id)-$(chap-challenge)”> $(else) <meta http-equiv=”refresh” content=”0; url=http://10.200.21.36/?nux-mac=$(mac)&nux-ip=$(ip)&nux-hostname=$(hostname)&nux-router=1&nux-key=$(chap-id)-$(chap-challenge)”> $(endif) |
---|
On the Hotspot Profile edit the Radius Tab and enable Use Radius

Add Walled Garden Entry for the IP of the PHPNuxBill server as the Dst. Host
