MelodAI Documentation

Shared Hosting Deployment (cPanel / Hostinger)

Deploy MelodAI on cPanel: PHP 8.3 extensions, document root, Hostinger package, HTTP cron, queue workers, SSL, and production .env.

Hosting Requirements

  • PHP 8.3 (8.2 minimum if host does not offer 8.3 yet)
  • MySQL 8 / MariaDB, SSH or Terminal access (strongly recommended)
  • Composer available via SSH or upload vendor from local build
  • Ability to set document root to Laravel public folder
  • Cron jobs (required for scheduler and queue processing)

Step 1: PHP Version and Extensions (cPanel)

In cPanel open Select PHP Version or MultiPHP INI Editor:

  • Select PHP 8.3 for your domain.
  • Enable: bcmath, ctype, curl, fileinfo, gd, intl, mbstring, mysql, pcntl, pdo_mysql, posix, openssl, tokenizer, xml, zip, exif.
  • Set memory_limit ≥ 256M, max_execution_time ≥ 300.

Verify from Terminal:

/usr/local/bin/php -m

Step 2: Build and Upload Hostinger Package

On your local machine (with Composer and Node installed), create the hosting archive:

composer run package-hostinger

Upload melodai-hostinger.zip via cPanel File Manager. Do not zip vendor or node_modules manually — large extracts often cause HTTP 500 on shared hosts.

  1. Extract zip into public_html (or a folder above it).
  2. Run composer install --no-dev --optimize-autoloader on the server after extract.

Step 3: Point Document Root to /public

  1. cPanel → Domains → edit your domain.
  2. Set document root to /home/USERNAME/public_html/public (adjust path to match extract location).
  3. If the host cannot change docroot, copy only public/* into public_html and update index.php paths to the Laravel root one level up.

Step 4: Configure Production .env

APP_ENV=production
APP_DEBUG=false
APP_URL=https://melodai.site
QUEUE_CONNECTION=database
FILESYSTEM_DISK=cloudflare

Set database credentials from cPanel MySQL Databases:

DB_DATABASE=cpuser_melodai
DB_USERNAME=cpuser_dbuser
DB_PASSWORD=strong_password

In Admin → Settings → General, set Site URL to your HTTPS domain. Cron HTTP URLs are generated from this value.

Step 5: Run Artisan Commands

From cPanel Terminal (use full PHP path):

/usr/local/bin/php /home/USERNAME/public_html/artisan key:generate --force
/usr/local/bin/php /home/USERNAME/public_html/artisan migrate --force
/usr/local/bin/php /home/USERNAME/public_html/artisan storage:link
/usr/local/bin/php /home/USERNAME/public_html/artisan config:cache
/usr/local/bin/php /home/USERNAME/public_html/artisan route:cache
/usr/local/bin/php /home/USERNAME/public_html/artisan view:cache

Complete /install if this is a fresh server, or ensure installer was completed once.

Step 6: Cron Jobs and Queue Workers

Open Admin → Cron & Queue on your live site and copy the exact commands shown (they include your token and server paths).

HTTP cron (recommended for scheduler):

curl -s "https://yourdomain.com/cron/schedule?token=YOUR_TOKEN" > /dev/null 2>&1

PHP queue workers (use full paths from admin page):

/usr/local/bin/php /home/USERNAME/public_html/artisan queue:work database --queue=default --sleep=3 --tries=3 --timeout=60 --stop-when-empty > /dev/null 2>&1

Never use melodai.site/public_html/artisan as the command — that is a hostname fragment, not a file path. Use /usr/local/bin/php + absolute path to artisan.

Suggested schedules:

  • Scheduler URL: every minute (* * * * *)
  • Default queue: every minute
  • Music generation queue: every 2 minutes (*/2 * * * *)
  • Video processing queue: every 2 minutes

Step 7: SSL and SMTP

Enable AutoSSL in cPanel, then force HTTPS in APP_URL and Site URL.

Configure mail in Admin → Settings → Mail or .env:

MAIL_MAILER=smtp
MAIL_HOST=mail.yourdomain.com
MAIL_PORT=465
MAIL_USERNAME=info@yourdomain.com
MAIL_PASSWORD=mailbox_password

Troubleshooting (Shared Hosting)

  • Unauthorized on cron URL: copy fresh URLs from Admin → Cron & Queue; ensure identical token on all jobs.
  • 500 after zip extract: run composer install --no-dev on server; check storage/logs/laravel.log.
  • Jobs stuck pending: verify queue cron commands use full PHP + artisan paths.
  • FFmpeg missing: ask host to enable FFmpeg or use VPS for video features.