Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mstnorris's avatar

Whoops handler only on local (Homestead) development

I have the old-style Whoops error pages working but I would like to limit them so that they only show when developing my app locally.

When I deploy to my Forge/Digital Ocean production server, I would like to standard, simple "Whoops, looks like something went wrong." message... Or, better yet, a custom styled error page.

Is this possible?

0 likes
11 replies
mstnorris's avatar

Thanks, I do have my .env already set up correctly on my local development machine and the APP_ENV and APP_LOCAL variables are not present on my forge server yet the full "Whoops" error pages are being shown.

How would I use environment variables to set which error pages I use?

mstnorris's avatar

That isn't it I don't think: Here is a screenshot of the environment variables page from my Forge installation.

Environment Variables

I added the variable like you suggested (as you can see when you select "Application Uses Laravel 5.0+" the "Environment" field is removed).

New Variabled Added

Would I need to edit anything in my bootstrap/app.php file to utilise the environment variables?

RomainLanz's avatar

With Laravel 5 you only have one environment, so you don't need to set it on forge.

But you need to change the value of APP_LOCAL.

mstnorris's avatar

Unfortunately that doesn't help. Maybe it is the way the Whoops page is being called.

mstnorris's avatar

Yes I did

Env Variables

When I cat my .env file from SSHing into Forge, this is a part of it (only excluding the APP_KEY and database details).

APP_ENV=production
APP_DEBUG=false
APP_LOCAL=production
RomainLanz's avatar

How did you add Whoops? With GrahamCambell's package?

mstnorris's avatar

I'm using this package https://github.com/filp/whoops

I've added this to my bootstrap/app.php file

$app->singleton(
    'Illuminate\Contracts\Debug\ExceptionHandler',
        'App\Exceptions\WhoopsHandler',
    'App\Exceptions\Handler'

);

Please or to participate in this conversation.