New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined constant CRAFT_ENVIRONMENT and code 0 #476
Comments
Have you defined the environment in a
https://github.com/craftcms/craft/blob/97f9cfed7301381873046ca3a0b7919bce7ad75e/.env.example.dev#L8 |
Yes its defined and accessible inside craft. |
Can you please try catching the context panic errors as per 49624dd, to see if we can get any more helpful info? |
Our environment is not set with the same name as described in the doc, but is later correctly defined as CRAFT_ENVIRONMENT. .env
web/index.php
I dumped it before the try & catch and it seems to exist.
Errors from the context panic
|
Console requests don't go through The environment is now set as part of the bootstrapping process: I suggest you update to use |
It looked like the upgrade to v4 was not done cleanly by us. I copied the following files based on the new version in my project:
What solved the problem for me though was upgrading phpdotenv from Thanks for your support! |
Ah yes, that catches lots of people out, documented here for reference: |
The catching of context panic errors has been released in version 4.4.0. |
Description
After installing Blitz Cache I wanted to generate the cache via Command. However, when executing the command it aborts already at the beginning with the error message "Undefined constant "CRAFT_ENVIRONMENT"" and code "0".
The named variable exists and is callable within Craft. So its probably something wrong set up.
console.log
Blitz version
4.3.3
Craft CMS version
4.3.9
PHP version
8.0.26
The text was updated successfully, but these errors were encountered: