This guide is for Laravel applications (e.g. a CMS backend or API) deployed to Hostcloud cPanel hosting with MySQL.
What you need
- An active hosting plan with SSH access and PHP 8.2+
- A domain already pointed to the hosting (see the domain pointing tutorial)
- Application code in Git or a ZIP file
1. Set the PHP version
In cPanel, open MultiPHP Manager, select the domain, and set it to PHP 8.2 or newer. Make sure the mbstring, pdo_mysql, openssl, fileinfo, and intl extensions are enabled in Select PHP Version.
2. Create a MySQL database
- Open MySQL Databases and create a new database.
- Create a user with a strong password, then add it to the database with All Privileges.
- Note down the database name, user, and password.
3. Upload the code
Via SSH:
cd ~
git clone git@github.com:perusahaan/aplikasi.git app
cd app
composer install --no-dev --optimize-autoloader
Place the application folder outside public_html, then point the domain's document root to the application's public folder (cPanel → Domains → change Document Root).
4. Configure .env
cp .env.example .env
php artisan key:generate
Edit .env:
APP_ENV=production
APP_DEBUG=false
APP_URL=https://namadomain.com
DB_DATABASE=cpuser_app
DB_USERNAME=cpuser_app
DB_PASSWORD=********
5. Migrations and optimization
php artisan migrate --force
php artisan storage:link
php artisan config:cache && php artisan route:cache && php artisan view:cache
6. Cron for the scheduler and queue
Add this in Cron Jobs:
* * * * * cd /home/cpuser/app && php artisan schedule:run >> /dev/null 2>&1
Troubleshooting
- 500 error — check
storage/logs/laravel.logand the permissions of thestorageandbootstrap/cachefolders (775). - 404 on every page except the homepage — make sure the document root points to the
publicfolder. - Images don't show — rerun
php artisan storage:link.
Don't want to manage the server yourself? Use our Cloud Hosting & Server service — our team handles deployment and maintenance.
If you still run into issues, our support team is ready to help 24/7.