Laravel Hosting Requirements: PHP Version, Composer, SSH and Git

A server checklist card showing Laravel hosting requirements: PHP 8.3+, Composer, SSH access and Git, each marked with a crimson check.

Laravel hosting requirements fit on one card: a recent PHP version with a handful of extensions, Composer, a way into the server over SSH, and Git to move code there. Most failed first deploys trace back to one of those four being missing, too old, or quietly disabled by the host.

This post turns that card into two small scripts you can keep in your repo. check-host.php tells you, before you upload anything, whether a server can run your app. deploy.sh uses Git and SSH to ship a new release and refresh the caches. Both were run against a fresh Laravel 13 project on November 4, 2026.

What this post covers

The Laravel server requirements checklist

The official Laravel deployment docs list the framework’s needs. On top of those, a real deploy needs a few things from the host that the docs take for granted.

RequirementWhat Laravel 13 needsHow to check
PHP version8.3 or newerphp -v
PHP extensionsctype, curl, dom, fileinfo, filter, hash, mbstring, openssl, pcre, pdo, session, tokenizer, xmlphp -m
Database driverA PDO driver for MySQL, PostgreSQL, SQLite or SQL Serverphp -r 'print_r(PDO::getAvailableDrivers());'
ComposerComposer 2composer -V
SSHShell access as your hosting userssh user@host
GitAny current Git client on the servergit --version
Writable foldersstorage and bootstrap/cachels -ld storage bootstrap/cache
Web rootPointed at public/, never the project rootHosting panel or vhost config

The PHP line is the one that moves. Laravel 13 asks for PHP 8.3, so a host stuck on 8.1 or 8.2 can’t run it at all. If you’re weighing an upgrade, why and how to upgrade your PHP version covers the risk side, and modern PHP features from 8.0 to 8.4 covers what you get for it.

The web root line matters for security, not just routing. If the domain points at the project root instead of public/, files like .env can end up reachable from a browser. The Laravel docs say the same: never move index.php up to the root.

Tested versions

ToolVersion
Laravel Framework13.40.0 (fresh laravel/laravel skeleton)
PHP8.4.27 CLI
Composer2.8.8
Git2.47.3
OSLinux (Debian-based)

The skeleton’s composer.json requires "php": "^8.3", which is where the script below reads the minimum from.

Check a server before you deploy

Composer already has composer check-platform-reqs, which compares your installed packages against the server’s PHP and extensions. It’s worth running. But it needs a vendor folder or a lock file and it says nothing about SSH tools, disabled functions or folder permissions, and those are the things that break on budget hosting. So here’s a small script that checks all of it and exits with code 1 when anything fails, which makes it usable in a deploy script too.

<?php
// check-host.php: run on the server with `php check-host.php /path/to/app`
// Prints PASS/FAIL for what a Laravel app needs. Exit code 1 if anything fails.

$app = rtrim($argv[1] ?? getcwd(), '/');
$fails = 0;

function check(string $label, bool $ok, string $hint = ''): void {
    global $fails;
    if (!$ok) $fails++;
    printf("%-4s %s%s\n", $ok ? 'PASS' : 'FAIL', $label, (!$ok && $hint) ? "  ($hint)" : '');
}

// 1. PHP version: read the constraint from the app's composer.json
$composer = json_decode((string) @file_get_contents("$app/composer.json"), true);
$constraint = $composer['require']['php'] ?? '^8.3';
preg_match('/(\d+\.\d+(\.\d+)?)/', $constraint, $m);
$min = $m[1] ?? '8.3';
check("PHP " . PHP_VERSION . " meets $constraint", version_compare(PHP_VERSION, $min, '>='), "ask the host to switch to PHP $min or newer");

// 2. Extensions listed in the Laravel server requirements
$exts = ['ctype', 'curl', 'dom', 'fileinfo', 'filter', 'hash', 'mbstring',
         'openssl', 'pcre', 'pdo', 'session', 'tokenizer', 'xml'];
foreach ($exts as $ext) {
    check("ext-$ext", extension_loaded($ext), 'enable it in the PHP selector or php.ini');
}

// 3. A PDO driver for your database
$drivers = class_exists('PDO') ? PDO::getAvailableDrivers() : [];
check('PDO driver (' . (implode(', ', $drivers) ?: 'none') . ')',
      (bool) array_intersect($drivers, ['mysql', 'pgsql', 'sqlite', 'sqlsrv']));

// 4. Functions Composer and Artisan rely on, often disabled on shared plans
$disabled = array_map('trim', explode(',', (string) ini_get('disable_functions')));
foreach (['proc_open', 'proc_get_status', 'putenv'] as $fn) {
    check("$fn() allowed", function_exists($fn) && !in_array($fn, $disabled, true), 'Composer needs this');
}

// 5. Writable directories
foreach (['storage', 'bootstrap/cache'] as $dir) {
    check("$dir is writable", is_dir("$app/$dir") && is_writable("$app/$dir"), "chmod -R ug+rw $dir");
}

// 6. Command-line tools on the PATH
foreach (['git', 'composer'] as $bin) {
    $path = trim((string) shell_exec("command -v $bin 2>/dev/null"));
    check("$bin on PATH" . ($path ? " ($path)" : ''), $path !== '', "install $bin or use a full path");
}

// 7. A memory limit Composer can live with
$mem = ini_get('memory_limit');
check("memory_limit $mem", $mem === '-1' || (int) $mem >= 256 || stripos($mem, 'G') !== false, 'raise it if Composer runs out of memory');

echo $fails ? "\n$fails check(s) failed.\n" : "\nAll checks passed.\n";
exit($fails ? 1 : 0);

Run it on the server from the app folder:

php check-host.php /home/user/app

On a healthy server every line says PASS. To see the failure path, I ran it with two common shared-hosting restrictions forced on:

php -d memory_limit=128M -d disable_functions=proc_open check-host.php .

FAIL proc_open() allowed  (Composer needs this)
FAIL memory_limit 128M  (raise it if Composer runs out of memory)

2 check(s) failed.

Those two are worth checking first. Composer runs other processes through proc_open, and some hosts disable it for every account. If it’s disabled you can still run Composer on your own machine and upload vendor/, but the Git-only flow below won’t work. The 256M memory floor is my own rule of thumb, not an official number.

Why SSH and Git matter

You can deploy Laravel by uploading a zip through a file manager. It works once. The second time, you’re comparing folders by hand and hoping you didn’t overwrite .env or storage/.

SSH gives you a terminal on the server, which means you can run php artisan migrate, clear caches and read logs where the app actually runs. Git gives you a repeatable way to move code: the server pulls an exact commit, and rolling back is a matter of pointing at the previous one. Together they turn a deploy into a few commands you can put in a file.

For the SSH side, use a key rather than a password. Generate one locally with ssh-keygen -t ed25519, add the public key in your hosting panel or to ~/.ssh/authorized_keys, and give the server its own read-only deploy key for your Git repository so it can pull without your personal credentials.

A Git and SSH deploy flow

This script lives in the repository next to check-host.php. It refuses to run if the server fails the checks, pulls the branch, installs production dependencies, runs migrations and rebuilds Laravel’s caches.

#!/usr/bin/env bash
# deploy.sh: pull a branch over SSH and refresh a Laravel app in place.
# Usage on the server: ./deploy.sh /home/user/app main
set -euo pipefail

APP_DIR="${1:?path to the app}"
BRANCH="${2:-main}"
PHP="${PHP_BIN:-php}"
COMPOSER="${COMPOSER_BIN:-composer}"

cd "$APP_DIR"

# Stop early if the server can't run this release
"$PHP" check-host.php "$APP_DIR" > /dev/null || { "$PHP" check-host.php "$APP_DIR"; exit 1; }

echo "Fetching $BRANCH"
git fetch --prune origin "$BRANCH"
OLD=$(git rev-parse --short HEAD)
git reset --hard "origin/$BRANCH"
NEW=$(git rev-parse --short HEAD)

"$PHP" artisan down --retry=15 || true
trap '"$PHP" artisan up' EXIT

"$COMPOSER" install --no-dev --prefer-dist --optimize-autoloader --no-interaction
"$PHP" artisan migrate --force
"$PHP" artisan optimize
"$PHP" artisan reload || true

echo "Deployed $OLD -> $NEW"

A few choices are deliberate:

  • git reset --hard origin/main instead of git pull, so a stray edit on the server can never cause a merge conflict mid-deploy. The flip side is that edits made on the server get thrown away, which is the point.
  • composer install --no-dev --optimize-autoloader installs exactly what composer.lock says, without test tools. Commit the lock file, or the server may resolve different versions than you tested.
  • migrate --force is needed because Laravel asks for confirmation before migrating in production.
  • php artisan optimize caches config, events, routes and views in one command. php artisan reload restarts queue workers so they pick up the new code.
  • The trap brings the app back up even if a step fails, so a broken Composer install doesn’t leave visitors on the maintenance page.

To test it, I cloned a fresh Laravel 13 app from a local bare repository, pushed a new commit, and ran the script against the clone. It printed Deployed 6fbf7be -> e195ca1, reloaded the queue and schedule, and the built-in /up health route returned 200 afterwards. You trigger it from your own machine over SSH:

ssh user@host 'cd ~/app && ./deploy.sh ~/app main'

This deploys in place, so there are a few seconds of maintenance mode. If you want no downtime at all, the next step is release folders and an atomic symlink switch, which I walk through in deploying Laravel with zero downtime using GitHub Actions.

Deploying Laravel on shared hosting

Shared plans vary the most. Before you pick one for a Laravel app, ask the host four direct questions: Which PHP versions can I choose per site? Is SSH available on my plan? Is Git installed? Can I set the document root to a subfolder? A yes to all four means the flow above works as written.

If SSH isn’t on the plan, you can still run Laravel, just with more manual steps: build vendor/ locally, upload it, and point the domain at public/. ResellerBytes has a step-by-step guide on how to host a Laravel website on shared hosting that covers that route through the hosting panel. For the bigger picture of where shared, VPS and managed hosting fit, see web hosting infrastructure explained.

FAQ

What PHP version does Laravel 13 need?

PHP 8.3 or newer. The skeleton’s composer.json declares ^8.3, and the tests in this post ran on PHP 8.4.27.

Can I deploy Laravel without SSH?

Yes. Run composer install --no-dev on your own machine, upload the project including vendor/, set the document root to public/, and run migrations through whatever the host provides. It works, but every deploy is manual.

Do I need Composer on the server?

Not strictly. You need the vendor folder Composer creates. Having Composer on the server lets you install from composer.lock during each deploy, which is faster and less error-prone than uploading thousands of files.

Which folders must be writable?

storage and bootstrap/cache, by the user the web server or PHP runs as. Nothing else in the project should need write access.

Is there a built-in way to check requirements?

composer check-platform-reqs checks PHP and extensions against your locked packages. See the Composer CLI docs for its options. It doesn’t check SSH tools, disabled functions or permissions, which is why the script above exists.


I’m Shahrukh Akhtar (Shaz3e), CTO & Co-Founder of Diligent Creators Pvt. Ltd., a Technology Executive & Product Builder. I run client delivery and build SaaS products, including EloSync. You can find me on X, LinkedIn, Peerlist and GitHub.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *