Deploying to Shared Hosting

A step-by-step guide for a typical cPanel-based shared host (Hostinger, Namecheap, GoDaddy, Bluehost, etc.). Steps are the same in spirit on other panels (Plesk, DirectAdmin) β€” just under different menu names.

Before you start: confirm your hosting plan gives you PHP 8.2 or newer and a MySQL database. Everything else below assumes those two are available. SSH access makes this much easier but isn't strictly required β€” both paths are covered.

1. Requirements checklist

  • PHP 8.2+ with extensions: openssl, pdo_mysql, mbstring, tokenizer, xml, ctype, json, bcmath, fileinfo, curl. Add gd if you want the image watermark feature to work.
  • A MySQL/MariaDB database (cPanel → MySQL Databases to create one, plus a user with all privileges on it).
  • Composer β€” ideally available in your host's terminal; if not, you'll run it on your own machine instead (covered below).
  • Your domain or subdomain already pointed at the hosting account.

2. Prepare the app on your own machine first

  1. Run composer install --no-dev --optimize-autoloader locally β€” this downloads vendor/ so you don't need Composer on the host at all.
  2. Copy .env.example to .env and fill in production values (you'll fix the DB credentials again once they exist on the host β€” see step 3).
  3. Generate an app key locally so you don't need SSH for it: run php artisan key:generate, or generate one offline with openssl rand -base64 32 and paste it into .env as APP_KEY=base64:....
  4. Zip the whole project folder (this now includes vendor/) β€” one zip upload is far faster than uploading thousands of individual files over FTP.

3. Create the database

In cPanel: MySQL Databases → create a database and a user, add the user to the database with All Privileges. Note the full database name, username, and password β€” shared hosts usually prefix them with your account name, e.g. cpaneluser_dbname.

4. Upload and place the files

The key rule: only the contents of the public/ folder should be web-accessible β€” everything else (app/, .env, etc.) must sit outside the public web root, or anyone could potentially browse to your .env file.

Option A β€” your host lets you set a custom document root (most cPanel accounts, via "Domains")

  1. Upload the whole project to a folder outside public_html, e.g. /home/youruser/preciseclassify.
  2. Extract the zip there via cPanel File Manager.
  3. Go to cPanel → Domains, find your domain, and set its Document Root to preciseclassify/public.

Option B β€” you can only serve from public_html directly (no document-root control)

  1. Upload the whole project to a folder outside public_html, e.g. /home/youruser/preciseclassify (same as Option A).
  2. Copy (not move) everything inside preciseclassify/public/ into public_html/.
  3. Edit the index.php you just copied into public_html/: it has two lines requiring vendor/autoload.php and bootstrap/app.php β€” change __DIR__.'/../vendor/autoload.php' to __DIR__.'/../preciseclassify/vendor/autoload.php', and the same pattern for the bootstrap line, so they point at the app folder that now sits one level up from public_html.

5. Configure .env on the server

Edit .env (via File Manager's code editor, or SSH) with your real values:

APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=cpaneluser_dbname
DB_USERNAME=cpaneluser_dbuser
DB_PASSWORD=your-db-password

Always set APP_DEBUG=false in production β€” leaving it on exposes stack traces (including config values) to visitors.

6. Run migrations & seed the database

With SSH access

SSH in, cd into the app folder, then run:

php artisan migrate --seed
php artisan storage:link
php artisan config:cache
php artisan route:cache

Without SSH access

Run php artisan migrate --seed against a MySQL database on your own machine (or a free local install), then use mysqldump to export the schema and seeded rows, and import that .sql file through cPanel's phpMyAdmin into the host's database. This gets you the same tables and starter data (default currencies, categories, admin user) without ever needing a terminal on the host.

7. Storage symlink & file permissions

php artisan storage:link creates a symlink so uploaded listing photos are web-accessible. Some shared hosts disable PHP's symlink() function for security β€” if the command errors or does nothing:

  • Check cPanel's MultiPHP INI Editor to see if symlink is in the disabled-functions list; ask support to remove it if so.
  • If it truly can't be enabled, as a fallback you can point FILESYSTEM_DISK at a folder directly under public/ instead of using the symlink, and adjust the upload paths in ListingController/VendorProfileController accordingly β€” more work, so it's worth pushing your host to allow symlink() first.

Make sure storage/ and bootstrap/cache/ are writable by the web server β€” 755 is usually enough on shared hosts; only go to 775/777 if you get permission-denied errors in storage/logs/laravel.log.

8. Set up the cron job (needed for expiry notifications)

cPanel → Cron Jobs → add a job that runs every minute:

* * * * * /usr/local/bin/php /home/youruser/preciseclassify/artisan schedule:run >> /dev/null 2>&1

The exact PHP path varies by host β€” check cPanel's MultiPHP Manager or ask support for the CLI PHP binary path if php alone doesn't work. This single cron entry is all Laravel's scheduler needs; it internally runs listings:notify-expiring daily.

9. Queues & real-time chat

By default nothing here needs a persistent background worker β€” notifications and jobs run synchronously, and chat works via polling. Shared hosts generally don't allow long-running processes, so:

  • Leave QUEUE_CONNECTION=sync (the default) β€” no queue worker to babysit.
  • Skip self-hosting Reverb (it needs a persistent WebSocket process shared hosts won't run). If you want real-time chat instead of 4-second polling, use a managed service like Pusher instead β€” it only needs outbound HTTPS calls, which works fine from shared hosting.

10. HTTPS and final checks

  1. cPanel → SSL/TLS Status → run AutoSSL (free Let's Encrypt certificate) for your domain.
  2. Confirm APP_URL in .env uses https://.
  3. Visit your domain, confirm the homepage loads, register a test account, post a test listing, and check /sitemap.xml renders.

Troubleshooting

Check storage/logs/laravel.log first β€” it almost always names the real error. Common causes: .env missing/misconfigured, storage/ or bootstrap/cache/ not writable, or APP_KEY not set.

Either composer install was never run (re-upload with vendor/ included, per step 2), or β€” if you used Option B in step 4 β€” the path you edited into public_html/index.php doesn't actually match where the app folder lives.

Confirm php artisan storage:link actually created the symlink (see step 7), and that the gd PHP extension is enabled in MultiPHP Manager if you want watermarking specifically.

Some shared plans cap memory_limit at 128M and max_execution_time at 30s, which can be tight for larger image uploads. Raise both in MultiPHP INI Editor if your plan allows it, or ask support to bump them for your account.