500 Internal Server Error when changing WP_ENV

I’m getting a 500 Internal Server Error when changing the WP_ENV from development to production on my server. I’m running the site locally on Valet but there’s no problems occuring when doing the same operation. I did run composer install after changing the variable.

The site works after changing back to development. Any ideas?

As logging (should be) is disabled on production, have you checked the logs for errors?
Maybe a plugin behaves differently on production environments, e.g. setting up logging and something goes wrong.

Thanks! Should i temporary add production.php in /config/environments with debugging enabled or do you have any other suggestions?

The site runs on Digital Ocean (nginx) with Laravel Forge.

You should do your debugging on development or on staging, but not on production system (though I admit, I did that, too for some more low-volume sites).
Ideally the staging system is identical or as similar as possible to your production system.
With staging and production being equal, you can debug your site on staging.
When you are using trellis, a separate staging environment is already built-in, just use the right (golden) image, like a minimal Ubuntu system of equal distro for staging.

Ok i’ll set up a staging droplet that replicates the production. I’m not using Trellis so far but i’ll look into it, it sounds pretty nice. Big thanks for taking time on this!

This topic was automatically closed after 42 days. New replies are no longer allowed.