How Laravel runs on Web Hosting
Laravel runs on Web Hosting, our cPanel hosting, not on Sites & Apps. You get SSH in a walled-off space of your own, so Composer, Artisan and Git work on the server just as they do on your computer.
Laravel 13 needs PHP 8.3 or newer. The php command on the server is 8.2, so you run Laravel's commands with ea-php84 (or ea-php83) and choose the same version for your domain in MultiPHP Manager. The steps above are exactly what we ran to test it.
Your app lives in a folder in your home directory, and public_html points at its public folder. So your code, .env and storage can't be reached from the web. Unlike Sites & Apps, Web Hosting keeps your files between deploys, so storage and a SQLite database stay put.
After your first deploy
Cache your configuration, routes and views for speed, and link the public storage folder if your app serves uploaded files:
Over SSH
cd ~/laravel
ea-php84 artisan storage:link
ea-php84 artisan optimizeTo release a new version from Git, pull it, install packages, run migrations and cache again:
Over SSH
cd ~/laravel
git pull
ea-php84 ~/bin/composer install --no-dev
ea-php84 artisan migrate --force
ea-php84 artisan optimizeRun ea-php84 artisan optimize again whenever you change .env, because cached configuration doesn't read it.
Databases and email
For MySQL, create the database and its user in cPanel and add the user to the database. cPanel puts your username in front of both names. In .env, set DB_CONNECTION=mysql, DB_HOST=localhost and those names. Or keep Laravel's default SQLite database, which stays on your hosting between releases.
To send mail from your app, create an email account on your domain in cPanel and point Laravel's mail settings at falcon.cloudzyro.com on port 465 with SSL, signing in with the full address and its password. See Set up email.
Common Laravel problems and fixes
The usual causes, and what to do about them. Still stuck? Use Get help in the console, or email support@cloudzyro.com.
- Artisan or Composer says it needs a newer PHP version.
- The
phpcommand is 8.2. Runea-php84 artisanandea-php84 ~/bin/composerinstead, and choose PHP 8.4 for your domain in MultiPHP Manager. - No application encryption key has been specified.
- A cloned app has no key yet. Copy
.env.exampleto.envif you haven't, then runea-php84 artisan key:generate. - The site went back to an older PHP version.
- cPanel keeps the version in your public folder's
.htaccess. Choose PHP 8.4 in MultiPHP Manager again after linkingpublic_htmlto Laravel's public folder. - Server error on every page.
- With
APP_DEBUG=falsethe details are instorage/logs/laravel.log. Missing.envvalues and a database that isn't set up yet are the usual causes. - The scheduler never runs.
- Cron needs full paths:
cd ~/laravel && /usr/local/bin/ea-php84 artisan schedule:run, every minute.
What Laravel hosting costs
Lite is $6.99 a month, or $39.99 a year ($3.33 a month), for up to 30 websites, 30 GB of NVMe storage and 30 email accounts, plus tax. Growth and Max add more websites, storage and email. Every plan includes SSH, MySQL, email and 30 days of backups, with a 30-day money-back guarantee on the hosting. See Web Hosting.