Introduction
Laravel runs on shared hosting when the host provides four things: SSH, Composer, a per-site PHP version, and cron. Without them, you are limited to uploading files by FTP, which is where the advice that Laravel needs a VPS comes from. This guide covers the configuration a Laravel application needs on Litehost.
Setting the Document Root
Laravel expects the web server to serve its public directory. If the project root is served instead, everything above public becomes reachable over the web, including your .env file with its database credentials and application key.
Set the site’s document root to the project’s public folder.
Warning: Do not move
index.phpup a level and rewrite the paths inside it. This puts the whole framework back inside the web root.
Configuring the Database
Set the database host to localhost in your .env file:
DB_HOST=localhost
Each site runs in its own container, so 127.0.0.1 refers to that container’s own loopback, and the database is not there. 127.0.0.1 forces a TCP connection to an address with nothing listening, while localhost resolves through the socket the site is allowed to use. With the wrong host, Laravel fails with an error that looks like a credentials problem.
Running the Scheduler
The panel can keep a command running and restart it if it exits. Worker processes are available on every plan.
Open the site, then Advanced and Worker processes, click Launch, and choose Laravel. Set the command to php artisan schedule:work and the working directory to the folder that holds artisan. The scheduler then runs every minute, with its log under the worker card.
If you prefer cron, the standard single entry works on every plan:
* * * * * cd /path/to/your/site && php artisan schedule:run >> /dev/null 2>&1
Both approaches need one entry, regardless of how many tasks you schedule.
Running Queues
The php artisan queue:work command is designed to run indefinitely, which suits a worker process. Launch a second Laravel worker with php artisan queue:work --tries=3 and the same working directory. It starts with the site and restarts if it exits, as Supervisor would on a VPS.
The queue worker and scheduler guide covers the form and the settings that stop a worker from starting. Horizon, Reverb, and Octane have their own guide.
If you would rather not run a permanent process, a cron entry with php artisan queue:work --stop-when-empty --max-time=55 drains the queue once a minute and exits. This is sufficient for a low traffic application.
Deploying
The panel can deploy from a GitHub repository on every push or on demand, running your build script inside the site’s container. The GitHub deploy guide covers the setup and a build script that carries .env forward between releases.
Otherwise, you may deploy over SSH:
git pull
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
Warning: Only run
config:cacheonce your.envfile is correct. Caching reads the file once and stores the result, so a stale configuration cache keeps old values after you fix the setting. If a deploy leaves the site broken for no clear reason, clear the cached bootstrap files first.
Directory Permissions
The storage and bootstrap/cache directories must be writable by the web user. A permissions error on a fresh deploy is nearly always caused by these directories. Do not use chmod -R 777, which makes them world writable on a shared server.
Plan Features
SSH, Composer, Git, cron, worker processes, GitHub deploy, and a per-site PHP selector from 5.6 to 8.5 are included on every plan, including the entry tier. Private Redis and PostgreSQL start at the Business tier on Linux and WordPress, and are included on every Laravel Hosting plan. If your queue or cache configuration uses Redis, or you want Horizon, you should choose a Laravel plan.