Skip to content
Deploying apps5 min read

Deploy Laravel on cPanel without SSH

Short answer

Without SSH, build everything on your computer: composer install --no-dev for the same PHP version the server runs, and npm run build. Upload the project with vendor as a ZIP outside public_html and point the domain at the public folder. Create tables by importing an SQL file in phpMyAdmin or with a protected route you run once and delete. If you update often, a plan with SSH is simpler.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. What works without SSH and what doesn’t
  2. Before you start
  3. Steps
  4. When a plan with SSH is simpler
  5. Troubleshooting
  6. On ArabyHost

Without SSH you can’t run composer install or php artisan on the server, but Laravel doesn’t need them to run. It needs finished files: the vendor folder, the built front-end assets, a .env file and the database tables. You prepare all of that on your computer and upload it. This guide covers only what changes when there’s no terminal; the full walkthrough of the document root, .env and permissions is in the Laravel deploy guide.

What works without SSH and what doesn’t

Task Without SSH Instead
Installing packages Not on the server composer install locally, upload vendor
Vite build Not on the server npm run build locally, upload public/build
migrate Not from a terminal SQL import, a one-time route, or a temporary cron
Scheduler schedule:run Yes From Cron Jobs
A permanent queue worker No queue:work --stop-when-empty from the scheduler

Before you start

  • PHP, Composer and Node.js on your computer.
  • A PHP version on the hosting that suits your Laravel version. Check it in cPanel’s MultiPHP Manager (see choosing a PHP version).
  • A database and user created in MySQL Databases (see create a MySQL database).

Steps

1. Build vendor for the server’s PHP version

If your computer runs a newer PHP than the server, Composer may install packages that won’t run there. Tell it the server’s version first (8.3 here):

composer config platform.php 8.3
composer install --no-dev --optimize-autoloader
npm ci && npm run build
php artisan optimize:clear

The last command matters: it deletes cache files in bootstrap/cache that contain your computer’s paths, such as C:\Users\.... Upload them and Laravel looks for files that don’t exist on the server.

2. Zip the project

Include app, bootstrap, config, database, public (with public/build), resources, routes, storage, vendor, artisan, composer.json and composer.lock. Leave out node_modules, .git, .env and the log files in storage/logs.

3. Upload and extract outside public_html

In File Manager, go to your home folder /home/USER, create a folder named myapp, upload the ZIP into it with Upload, then select it and click Extract. Next open Settings at the top right of File Manager, enable Show Hidden Files (dotfiles), and check that myapp/public/.htaccess exists. Without it, every URL except the home page returns 404.

4. Point the domain at public

In Domains, create the domain or subdomain with Document Root set to myapp/public, or change an existing domain’s root. If you must use public_html, follow the index.php method in the Laravel deploy guide.

5. Create .env on the server

In myapp, copy .env.example to .env (select it, then Copy) and open it with Edit. The key values:

APP_ENV=production
APP_DEBUG=false
APP_URL=https://example.com
APP_KEY=
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=cpuser_app
DB_USERNAME=cpuser_app
DB_PASSWORD=strong-password

To fill APP_KEY, run php artisan key:generate --show locally and paste the output. Make sure DB_CONNECTION=mysql, because Laravel 11 and later default to sqlite.

6. Create the tables, one of three ways

A. Import an SQL file (simplest): run php artisan migrate locally against a local MySQL database, then export it from your local phpMyAdmin or with:

mysqldump -u root -p myapp_local > myapp.sql

On the hosting, open phpMyAdmin, select your database, open the Import tab and upload the file. Note: if your local database is SQLite, its file can’t be imported into MySQL; use method B.

B. A protected one-time route: add a line like DEPLOY_TOKEN= to the server’s .env with a long random value from the password generator, and temporarily add this to routes/web.php:

use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Route;

Route::get('/_deploy/{token}', function (string $token) {
    $expected = env('DEPLOY_TOKEN');
    abort_if(! $expected || ! hash_equals($expected, $token), 404);

    Artisan::call('migrate', ['--force' => true]);
    $out = Artisan::output();
    Artisan::call('storage:link');
    $out .= Artisan::output();

    return response('<pre>'.e($out).'</pre>');
});

Open https://example.com/_deploy/YOUR-TOKEN once and read the output. Then delete the route from the file and remove DEPLOY_TOKEN from .env. A route left behind is an open door to your database.

C. A temporary cron job: it runs for one minute and you delete it; the full command is in the Laravel deploy guide.

7. Permissions and the scheduler

Make sure storage and bootstrap/cache are 755 for folders and 644 for files, using Permissions in File Manager. Never use 777. Then add the every-minute schedule:run job in Cron Jobs, as in the cron jobs guide.

8. Later updates

For code-only changes, upload and replace the edited files. If composer.json changed, rebuild vendor locally and upload all of it. After changing .env or config, delete bootstrap/cache/config.php and routes-v7.php if they exist so Laravel reads the new values. For new migrations, bring back the protected route, run it, and delete it again.

When a plan with SSH is simpler

This method suits a site that changes rarely. It gets tiring if you update weekly, work with a team through Git, need queue workers running all the time, or use packages that run Composer scripts on install. With SSH an update is four commands: git pull, composer install, php artisan migrate --force and php artisan optimize.

Troubleshooting

On ArabyHost

On ArabyHost shared plans Laravel runs exactly this way: PHP 8.1 to 8.3 chosen in MultiPHP Manager, MySQL/MariaDB, uploads by ZIP or from GitHub through Git Version Control, and cron for the scheduler, without SSH. The AI/Developer plans add SSH jailed in CageFS with Git and Composer, so you run composer and artisan on the server. You can upgrade from any website plan to an AI/Developer plan and pay only the difference for the days left; current prices in your currency are on the pricing page. No plan has root access.

FAQ

Can I deploy Laravel on free hosting?

Some free hosts run PHP, but most restrict the version, functions or database, or add ads, so read their terms. Laravel 11 and 12 need PHP 8.2 or newer, a database and a cron job for the scheduler.

Does queue:work run without SSH?

You can't run a permanent worker without SSH, but you can call `queue:work --stop-when-empty` from the scheduler every minute through your schedule:run cron job. That's enough for emails and light jobs.

Why do I get "Composer dependencies require a PHP version" after uploading?

You built vendor on a computer with a newer PHP than the server. Set `composer config platform.php` to the server's version, delete vendor, run composer install again and re-upload it.

When should I move to a plan with SSH?

When you update more than once a week, need queue workers that run all the time, or work with a team through Git. You then run composer and artisan on the server instead of re-uploading vendor every time.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.