Run a Laravel app

laravel, php, artisan, composer, public folder, cache · 0 found this helpful

Laravel runs on PHP, so a Laravel app uses the same PHP version, settings and caching tools as any PHP site. The site's dashboard recognizes it as a Laravel app and shows the PHP, Cache and Speed tabs.

Before you start

  • You need SSH to run composer and artisan. See Connect with SSH.
  • Check which PHP version your Laravel release needs. Laravel 11 and 12 need PHP 8.2 or newer.

Set up the folder

Laravel serves pages from its public folder. Put the app beside your site folder and make the site's folder point at public:

  1. Upload or clone the app to its own folder, such as ~/apps/shop.
  2. In Websites, set the site's folder to apps/shop/public, or add a new site with that folder.
  3. Over SSH, install packages and prepare the app:
cd ~/apps/shop
composer install --no-dev --optimize-autoloader
cp .env.example .env
php artisan key:generate
php artisan migrate --force

Keep .env outside public. It holds your database password.

Pick the PHP version and settings

  1. Open the site from Websites and go to the PHP tab.
  2. Choose a Version your Laravel release supports, and click Save.
The PHP tab for a Laravel app

Open Settings to raise Memory per request or Largest upload if the app needs it. See Change PHP settings.

php on the command line runs the account default version. If the site uses another version, ask us for that version's path and use it to run artisan.

Make it fast

  1. Cache config, routes and views after each deploy:
php artisan config:cache
php artisan route:cache
php artisan view:cache
  1. On the site's Cache tab, choose a Page cache time for public pages. Form posts, and visitors with a session, sign-in or cart cookie, get fresh pages. See Caching for sites not built on WordPress.
  2. Choose a Browser cache preset so browsers keep built assets. Laravel's asset builder adds a version to file names, so Long works well.
  3. Measure on the Speed tab before and after. See Read the Speed tab.

Scheduled tasks and queues

Laravel's scheduler needs to run every minute. Add it in Schedules: choose PHP script, pick artisan in your app's folder, add the argument schedule:run, and repeat it every 1 minute with If still running set to Skip. See Run tasks on a schedule.

For queues, use the database queue driver and add a second schedule that runs artisan queue:work --stop-when-empty every minute. On plans with workers, you can keep queue:work running instead. See Keep a background worker running.

If something goes wrong

Problem Fix
500 error with no details Check storage/logs/laravel.log. Make storage and bootstrap/cache writable
"Your PHP version doesn't satisfy" Choose a newer Version on the PHP tab, and use the same version on the command line
Changes don't show after deploy Run php artisan optimize:clear, then the cache commands again, and click Clear cache on the Cache tab
Signed-in pages show someone else's content Turn the page cache off, then make sure the app's session cookie name contains session, sess, auth or token. Pages for visitors with such a cookie are never cached

Was this helpful?

Still stuck? Ask us and we'll walk you through it.