Skip to content

Laravel on shared hosting without SSH: how to deploy your app

· The AYT team · 6 min read

Developer desk with two monitors, one showing code

To deploy Laravel on shared hosting without SSH: run composer install --no-dev and npm run build locally, upload the whole project (with vendor/) into a folder outside the web root, make the domain serve only the public/ folder, fill in .env, and run the artisan commands (migrations, storage:link) through cron jobs or from a panel that runs them. It works, provided the host has the PHP version Laravel needs: Laravel 13 requires PHP 8.3 or newer.

What to check on your shared hosting before Laravel

  • The PHP version: Laravel 13 needs at least 8.3. Laravel 12 also runs on 8.2.
  • The PHP extensions Laravel requires: Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, XML.
  • Can you set the domain's document root to a subfolder? If not, read the article on the Laravel public folder first.
  • Is there a Cron Jobs page in the panel? Without SSH, cron is how you run artisan.
  • A MySQL or MariaDB database and access to phpMyAdmin.

Step 1: build the app locally

On your computer, in the project folder:

composer install --no-dev --optimize-autoloader
npm ci
npm run build

The first command puts only production packages in vendor/. The other two compile CSS and JavaScript into public/build. The server won't have Composer or Node, so everything it needs is built now.

Check your local PHP version: if it's newer than the server's, Composer may pick packages that won't run there. Pin the server's version in composer.json with composer config platform.php 8.3 (or whatever your host runs) and run composer update again.

Step 2: upload the project

The recommended layout on cPanel-style hosting:

/home/account/
├── laravel/          ← the whole project: app, vendor, .env, storage...
│   └── public/       ← the only folder served
└── public_html/

Zip the project (without node_modules/), upload it through the File Manager and extract it into /home/account/laravel. One large file uploads far faster than the thousands of files in vendor/ sent over FTP.

Then make the domain serve laravel/public. The cleanest way is to change the domain's document root in the panel. If your host won't let you, the alternatives (and their risks) are in the guide to the Laravel document root.

Step 3: the .env file

Copy .env.example to .env and fill in at least:

APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com
APP_KEY=base64:...
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=account_app
DB_USERNAME=account_app
DB_PASSWORD=password

Generate APP_KEY locally with php artisan key:generate --show and paste it into the file. APP_DEBUG=false is mandatory in production: with true, any error shows visitors details of your configuration. More in the article on .env in production.

Step 4: folder permissions

Laravel writes to storage/ (logs, cache, sessions, compiled views) and bootstrap/cache/. In the File Manager, make sure both are writable by the user PHP runs as. If they aren't, you get a 500 error on the first request.

Step 5: migrations without a command line

You have three options, safest first:

  1. A cron job that runs once. On the Cron Jobs page, add a job that runs a minute from now: cd /home/account/laravel && php artisan migrate --force. Wait for it to run, then delete it. Send the output to a file so you can see whether it worked: >> storage/logs/migrate.log 2>&1.
  2. Run the migrations locally on an empty database, export it and import it on the server with phpMyAdmin. That works for the first install, not for later updates when the server already holds data.
  3. A temporary route that calls Artisan::call('migrate', ['--force' => true]). This is the riskiest option: if you forget the route in the code, anyone can run migrations. If you use it, protect it with a long token and delete it right after.

Run php artisan storage:link (details in storage:link without SSH) and php artisan optimize the same way.

Step 6: scheduler and queues

If the app uses the scheduler, add the cron entry from the Laravel documentation on the Cron Jobs page, running every minute:

* * * * * cd /home/account/laravel && php artisan schedule:run >> /dev/null 2>&1

Details in the Laravel scheduler with cron. For queues, without a process that runs permanently, the classic workaround is a cron job with php artisan queue:work --stop-when-empty.

What the classic method costs you

Every update repeats the whole trip: local build, zip, upload, extract, migrations through cron. While you extract, the site can run on a mix of old and new files. There is no button to go back to the previous version unless you kept a copy yourself. For an app that changes often, the time adds up quickly.

Laravel on AYT hosting

AYT has no SSH, but the Laravel Toolkit handles the server side for you. Pick Laravel in Create a New Domain, or press "Make this a Laravel site" on an existing domain. The panel creates the database, a deploy key and the releases/, shared/ and current layout, and the site is served from current/public with no document-root changes.

Laravel Toolkit: the Deployments page with repository, branch and deploy history

On the Deployments page you connect a Git repository and branch, through the SSH deploy key or an HTTPS token. The default deploy script runs composer install, npm ci and a build if there's a package.json, php artisan migrate --force and php artisan optimize, and you choose Node per site (22 or 24). On each deploy the panel builds a new release in its own folder, switches to it, checks /up and, if it doesn't answer, swaps back to the previous release. The last 20 deploys are kept with logs, and there's a Roll back button (migrations are not reversed). A GitHub or GitLab webhook deploys on every push, as in the guide to automatic deploys from GitHub.

The panel writes .env when you make the site a Laravel site, with DB_*, APP_URL, APP_ENV=production and APP_KEY filled in, the first deploy adds any missing keys from .env.example, and you edit it from Settings. The storage folder and .env stay the same across releases. The Processes page starts queue workers or Horizon and has a switch for the scheduler, and Commands runs any non-interactive artisan command, for up to 120 seconds. See the supported apps and the plans.

More articles

All articles