Categories

Introduction

We are going to setup XMAPP in Ubuntu, before executing the detailed steps, a runing Ubuntu 18.04 server with Internet access is required.

Step 1: Download XAMPP

Download XAMPP using this link: xampp-linux-x64-5.6.40-1-installer.run. Then upload it to server.

Step 2: Install XAMPP

chmod +x xampp-linux-x64-5.6.40-1-installer.run
./xampp-linux-x64-5.6.40-1-installer.run

Step 3: Set XAMPP to start automatically when server boot

vim /etc/systemd/system/xampp.service
[Unit]
Description=XAMPP

[Service]
ExecStart=/opt/lampp/lampp start
ExecStop=/opt/lampp/lampp stop
Type=forking

[Install]
WantedBy=multi-user.target
systemctl enable xampp.service
systemctl start xampp.service
systemctl status xampp.service

Step 4: Create MySQL user and database

/opt/lampp/bin/mysql -h 127.0.0.1 -P 3306
CREATE DATABASE db;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON db . * TO 'user'@'localhost';
FLUSH PRIVILEGES;

Step 5: Restore MySQL database from a backup

/opt/lampp/bin/mysql -h 127.0.0.1 -P 3306 db < backup.sql

Step 6: Increase PHP memory limit

vi /opt/lampp/etc/php.ini
memory_limit=256M

Step 7: Fix issue MySQL consuming too much memory

vi /opt/lampp/etc/my.cnf
[mysqld]
table_definition_cache = 200
systemctl restart xampp.service

Step 7: Locate the website root and clean the folder

cd /opt/lampp/htdocs
rm -rf ./*

Step 8: Copy PHP source code to website root

cd /opt/lampp/htdocs
echo "<?php phpinfo(); ?>" > index.php

At last, open browser and visit http://server_ip

Reference