Brian
Brian

Reputation: 41

Laravel shows Symfony-styled exception even when APP_DEBUG set to false

Just deployed a new app to production and seeing a strange bug:

One of the pages has a PHP error and throws an exception. Strangely, it's a Symfony branded exception page (screenshot), different from the ones I've seen in Laravel before. Env file is already set to production environment and has APP_DEBUG=false.

Does anyone know how to fix this?

I've tried the following to clear & reset cache, but it didn't help

php artisan config:cache

Not sure if it matters, but the app was deployed using http://deployer.org with Deployer's Laravel recipe

Upvotes: 4

Views: 3347

Answers (1)

jgarcia
jgarcia

Reputation: 61

The mostly likely reason for this is that when deployer runs composer install, it does so with the --no-dev option, which prevents the required packages from being installed. If you want to include dev packages upon deployment, add the following to deploy.php:

set('composer_options', '--verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader');

This is the default composer_options value with --no-dev removed.

There are also slightly more complex options that include having different tasks for different hosts, which is detailed here: PHPDeployer: set variable for local task based on host?

Upvotes: 4

Related Questions