sudo fallocate -l 2G /swapfile || sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# optional but recommended
echo 'vm.swappiness=20' | sudo tee /etc/sysctl.d/99-swappiness.conf
sudo sysctl -p /etc/sysctl.d/99-swappiness.conf
free -h
swapon --show
Friday, February 27, 2026
Allocate swap file, when server RAM GB is low to remove mysql errors
Tuesday, February 10, 2026
cPanel multi-domain hosting for laravel project
STEP 1 — Create the Subdomain
cPanel → Domains → Create A New Domain (or Subdomains)
cPanel will automatically create:
/home/egproject/test.example.com/
STEP 2 — Correct Laravel Folder Structure (Very Important)
/home/egproject/
test/ ← FULL Laravel project
test.example.com/ ← ONLY public folder contents
STEP 3 — Upload Files Properly
1️⃣ Upload full project here:
/home/egproject/test/
app/
bootstrap/
config/
database/
public/
resources/
routes/
storage/
vendor/
.env
artisan
2️⃣ Now open:
/home/egproject/test/public/
Copy EVERYTHING inside public folder to:
/home/egproject/test.example.com/
So that folder contains:
index.php
.htaccess
css/
js/
images/
STEP 4 — Modify index.php (CRITICAL)
/home/egproject/test.example.com/index.php
Change these lines:
FROM:
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
TO:
require __DIR__.'/../test/vendor/autoload.php';
$app = require_once __DIR__.'/../test/bootstrap/app.php';
Because your Laravel core lives in /test.
STEP 5 — Update .env
APP_URL=https://test.example.com
DB_HOST=localhost
DB_DATABASE=egproject_db
DB_USERNAME=egproject_user
DB_PASSWORD=yourpassword
STEP 6 — Permissions (Very Important)
In File Manager:
Set:
test/storage → 755 test/bootstrap/cache → 755
If errors:
chmod -R 775 storage
chmod -R 775 bootstrap/cacheSTEP 7 — Set up database
cPanel → Database Manager → Create DB and setup user for that
Subscribe to:
Comments (Atom)