Closed alexanderloewe closed 1 year ago
Are you, by any chance using an older version of vlucas/phpdotenv
, somewhere around version 3? If that’s the case, I’d suggest updating to the latest one ^5.4
and checking if it will fix the issue.
I use version 2.6 🤪. By updating vlucas/phpdotenv
to ^5.4
I get a server error 500.
Do I have to change something else in the config files?
Running php 8.1.
Right, ok :) From what I remember, you might need to update your bootstrap.php
file so that it looks like here: https://github.com/craftcms/craft/blob/main/bootstrap.php.
Can you try that, and if it’s still acting up, please also let me know if there’s anything in the logs to suggest what the issue is?
Okay. Get it, thanks. With this it works fine.
// Load dotenv?
if (class_exists(Dotenv\Dotenv::class)) {
// By default, this will allow .env file values to override environment variables
// with matching names. Use `createUnsafeImmutable` to disable this.
Dotenv\Dotenv::createUnsafeMutable(CRAFT_BASE_PATH)->safeLoad();
}
Why does the Dotenv pack does not become update by Craft CMS itself? I used the same composer.json for years and never realized that I have to update the Dotenv version by my self. :D
Glad it’s all sorted now :)
So Craft updates the Dotenv version in its composer.json
, but the version that will be installed also depends on what you have in your project’s composer.json
. For example, if your project started as an early version of Craft 3, then Dotenv in your composer.json
was most likely around version 3. If you didn’t change it yourself, it would stay at version 3 even though the updated versions of Craft started requiring newer ones. For comparison, if you started your project with Craft 4, the Dotenv version would be around v5.4.
You might also want to have a look at this: https://craftcms.com/docs/4.x/upgrade.html#entry-script and double-check if there’s anything else you might want to update.
I hope this clears things up!
What happened?
Description
By running
queue/run
over a Cronjob I get this error:Deprecated: auto_detect_line_endings is deprecated in
/home/site/public_html/site/v1/vendor/vlucas/phpdotenv/src/Loader.php
on line 172The Cronjob looks like this
*/1 * * * * /usr/bin/php81 /home/site/public_html/site/v1/craft queue/run
Craft CMS version
Craft CMS 4.3.4
PHP version
8.1.11
Operating system and version
Linux 3.10.0-962.3.2.lve1.5.73.el7.x86_64
Database type and version
MySQL 5.7.37
Image driver and version
No response
Installed plugins and versions