How to Move a Laravel / PHP Application to Nairahost
A simplified but complete deployment guide for non-DevOps users
Introduction
Laravel and modern PHP apps are built differently from basic WordPress sites. They have environment variables, storage directories, routing files, and dependencies. Deploying these apps requires attention to folder structure and configuration.
???? This guide explains the simplest possible way to deploy a Laravel or PHP application on Nairahost shared or reseller hosting — no SSH required.
Requirements
- Your full Laravel project or PHP application folder
- Nairahost hosting with PHP 8.x support
- Database credentials
- .env file
Step 1: Arrange File Structure for Shared Hosting
Laravel’s default structure assumes you have access to the root filesystem. Shared hosting works differently.
The public folder must become your document root.
Correct Deployment Structure:
/home/username/
laravel_app/
public_html/ <-- contents of public folder go here
Meaning:
- Upload ALL Laravel files OUTSIDE public_html
- Only upload the contents of
public/intopublic_html
⚠️ Never put your entire Laravel framework inside public_html — you will expose sensitive files!
Step 2: Upload Files
Using File Manager in cPanel:
- Create folder
laravelin home directory - Upload ZIP containing app & extract
- Move
public/*intopublic_html/
Step 3: Configure .env Values
Edit /laravel/.env
APP_URL=https://yourdomain.com
APP_ENV=production
APP_DEBUG=false
DB_HOST=localhost
DB_DATABASE=mydb
DB_USERNAME=myuser
DB_PASSWORD=mypass
Update mail settings if using SMTP.
Step 4: Create & Import Database
- Open MySQL Databases in cPanel
- Create DB + user + password
- Import SQL via phpMyAdmin
Step 5: Fix Storage Directory Permissions
If your app stores uploads, run:
chmod -R 775 storage bootstrap/cache
If no SSH access, use File Manager → "Change Permissions"
Step 6: Set Correct Document Root
Check that public_html/index.php contains the right path:
require __DIR__.'/../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
Step 7: Run Composer (Optional)
If your app needs vendor packages:
- Upload
/vendorfrom dev environment - OR request support to run composer for you
Common Laravel Hosting Issues
- 500 error → wrong public folder location
- Class not found → vendor missing
- Database error → wrong DB credentials in .env
- Storage not writing → permissions wrong