30% Off — Save Up to 30% on Cloud HostingView promo →
Client AreaFree consultation
Hosting & DomainAdvanced

Deploying a Laravel Application to Hostcloud cPanel Hosting

Steps to upload a Laravel application, create a MySQL database, configure the .env file, and run migrations on cPanel hosting.

Estimated 15 minutes Updated August 20, 2026 Service: Hostcloud Hosting

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

  1. Open MySQL Databases and create a new database.
  2. Create a user with a strong password, then add it to the database with All Privileges.
  3. 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.log and the permissions of the storage and bootstrap/cache folders (775).
  • 404 on every page except the homepage — make sure the document root points to the public folder.
  • 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.

Was this tutorial helpful?

If you still run into issues, our support team is ready to help 24/7.

#laravel#deploy#cpanel#mysql

Need help right away?

Contact our support team — average response time under 5 minutes.

Free consultationView services