1) Install LAMPP (XAMPP for Linux) in /opt/lampp
Step 1: Become root (optional)
sudo -s
Step 2: Download XAMPP installer (example version)
The blog uses SourceForge XAMPP Linux installer download. (DevOps Consulting)
Use the latest version available, but the steps are same:
cd /opt
wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.2.4/xampp-linux-x64-8.2.4-0-installer.run
Step 3: Make it executable + install
chmod 755 xampp-linux-x64-8.2.4-0-installer.run
./xampp-linux-x64-8.2.4-0-installer.run
(Installer will place it into /opt/lampp.)
Step 4: Start LAMPP
/opt/lampp/lampp start
Check:
http://SERVER_IP/should load the XAMPP page.
2) Fix phpMyAdmin “Access Forbidden” (Require all granted)
The article specifically says to edit /opt/lampp/etc/extra/httpd-xampp.conf and change Require local → Require all granted to remove “forbidden” access. (DevOps Consulting)
Open file:
vi /opt/lampp/etc/extra/httpd-xampp.conf
Find phpMyAdmin directory block similar to:
<Directory "/opt/lampp/phpmyadmin">
Require local
</Directory>
Change to:
<Directory "/opt/lampp/phpmyadmin">
Require all granted
</Directory>
Restart:
/opt/lampp/lampp restart
3) Secure XAMPP / LAMPP (database protection)
Run the official security command:
sudo /opt/lampp/lampp security
This is the official recommended command from Apache Friends Linux FAQ. (Apache Friends)
It helps set passwords and reduces common security weaknesses.
4) Make sure you ALWAYS use PHP from /opt/lampp
Verify:
/opt/lampp/bin/php -v
Important rule: Whenever you run artisan, do:
/opt/lampp/bin/php artisan ...
5) Install Composer (works with /opt/lampp/bin/php)
cd /tmp
curl -sS https://getcomposer.org/installer -o composer-setup.php
/opt/lampp/bin/php composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
composer --version
6) Create or deploy Laravel project in /opt/lampp/htdocs
Option A: Create new Laravel project (like the blog)
The blog uses:composer create-project laravel/laravel:^9.0 example-app (DevOps Consulting)
Do:
cd /opt/lampp/htdocs
composer create-project laravel/laravel:^9.0 myproject
Option B: Clone existing project + install deps
cd /opt/lampp/htdocs
git clone YOUR_REPO_URL myproject
cd myproject
composer install
7) Fix common Composer errors (ext-xml / ext-curl)
The blog mentions these common errors while installing Laravel packages:
- missing ext-xml
- missing ext-curl (DevOps Consulting)
Step 7.1: Check what extensions your LAMPP PHP has
/opt/lampp/bin/php -m | egrep "curl|xml|dom|mbstring|openssl|pdo"
Laravel expects cURL + XML (and others). (Laravel)
Step 7.2: Enable extensions in LAMPP php.ini
Open:
vi /opt/lampp/etc/php.ini
Search and ensure these are enabled (no ; in front):
extension=curl
extension=xml
extension=dom
extension=mbstring
extension=openssl
extension=pdo_mysql
Restart:
/opt/lampp/lampp restart
Then retry:
cd /opt/lampp/htdocs/myproject
composer install
Note: On many Ubuntu systems, missing
curl/xmlcan also be fixed by OS packages, but since you’re using/opt/lampp/bin/php, the main fix is enabling the extensions shipped with LAMPP in/opt/lampp/etc/php.ini.
8) Permissions (LAMPP runs as daemon)
Set ownership:
chown -R daemon:daemon /opt/lampp/htdocs/myproject
Laravel writable folders:
chmod -R 775 /opt/lampp/htdocs/myproject/storage
chmod -R 775 /opt/lampp/htdocs/myproject/bootstrap/cache
9) Configure .env + generate APP KEY
cd /opt/lampp/htdocs/myproject
cp .env.example .env
/opt/lampp/bin/php artisan key:generate
10) Database security (BEST PRACTICE for Laravel)
Step 10.1: Set MySQL root password (already done by lampp security)
But you can login to confirm:
/opt/lampp/bin/mysql -u root -p
Step 10.2: Create dedicated DB + user (do NOT use root in Laravel)
Inside MySQL shell:
CREATE DATABASE myproject_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'myproject_user'@'localhost' IDENTIFIED BY 'StrongPasswordHere!123';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER
ON myproject_db.* TO 'myproject_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 10.3: Put DB details in .env
Edit:
vi /opt/lampp/htdocs/myproject/.env
Set:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myproject_db
DB_USERNAME=myproject_user
DB_PASSWORD=StrongPasswordHere!123
Migrate:
cd /opt/lampp/htdocs/myproject
/opt/lampp/bin/php artisan migrate
11) Setup Virtual Host in LAMPP (Apache)
Step 11.1: Enable vhosts include
Open:
vi /opt/lampp/etc/httpd.conf
Uncomment (enable):
Include etc/extra/httpd-vhosts.conf
Also ensure rewrite module enabled:
LoadModule rewrite_module modules/mod_rewrite.so
Step 11.2: Create vhost config
Open:
vi /opt/lampp/etc/extra/httpd-vhosts.conf
Add:
<VirtualHost *:80>
ServerName myproject.local
DocumentRoot "/opt/lampp/htdocs/myproject/public"
<Directory "/opt/lampp/htdocs/myproject/public">
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/myproject_error.log"
CustomLog "logs/myproject_access.log" common
</VirtualHost>
Restart:
/opt/lampp/lampp restart
Step 11.3: Add host entry (on your PC)
If you’re opening in browser from your laptop/PC, add:
Windows: C:\Windows\System32\drivers\etc\hosts
Linux/Mac: /etc/hosts
SERVER_IP myproject.local
Now open:http://myproject.local
12) Secure phpMyAdmin with password (recommended)
Even after “Require all granted”, you should protect it.
Step 12.1: Create htpasswd file
Apache’s htpasswd tool creates password file for Basic Auth. (httpd.apache.org)
sudo apt install -y apache2-utils
sudo htpasswd -c /opt/lampp/etc/.pma_pass admin
Step 12.2: Protect phpMyAdmin directory in httpd-xampp.conf
Edit:
vi /opt/lampp/etc/extra/httpd-xampp.conf
Add/update:
<Directory "/opt/lampp/phpmyadmin">
AuthType Basic
AuthName "Restricted phpMyAdmin"
AuthUserFile /opt/lampp/etc/.pma_pass
Require valid-user
AllowOverride None
</Directory>
Restart:
/opt/lampp/lampp restart
Now http://SERVER_IP/phpmyadmin will ask username/password first.
13) Extra hardening you should do (production-safe)
A) Restrict phpMyAdmin to your IP only (optional but strong)
Instead of open access, allow only your IP:
<Directory "/opt/lampp/phpmyadmin">
Require ip YOUR_PUBLIC_IP
</Directory>
Or allow localhost only:
<Directory "/opt/lampp/phpmyadmin">
Require ip 127.0.0.1
</Directory>
B) Bind MySQL to localhost (prevents remote DB access)
Edit MySQL config (location may differ by LAMPP version, often /opt/lampp/etc/my.cnf):
vi /opt/lampp/etc/my.cnf
Under [mysqld]:
bind-address=127.0.0.1
Restart:
/opt/lampp/lampp restart
Quick “Run Commands” Summary (copy-paste checklist)
# start/stop
sudo /opt/lampp/lampp start
sudo /opt/lampp/lampp restart
# secure xampp
sudo /opt/lampp/lampp security
# laravel key
cd /opt/lampp/htdocs/myproject
/opt/lampp/bin/php artisan key:generate
# migrate
/opt/lampp/bin/php artisan migrate
I

I’m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I’ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains:
-
DevOps School – Tech blogs and tutorials
-
Holiday Landmark – Travel stories and guides
-
Stocks Mantra – Stock market strategies and tips
-
My Medic Plus – Health and fitness guidance
-
TrueReviewNow – Honest product reviews
-
Wizbrand – SEO and digital tools for businesses
I’m also exploring the fascinating world of Quantum Computing.
Best Cardiac Hospitals Near You
Discover top heart hospitals, cardiology centers & cardiac care services by city.
Advanced Heart Care • Trusted Hospitals • Expert Teams
View Best Hospitals