Closed JonnyBR12 closed 2 months ago
Hard to guess. Is there something in the logs? (make sure to enable dev mode)
Hi @ostark, can't see anything in any logs. Same environment as other sites. We've disabled all plugins apart from yours and no luck still. We'll keep digging.
Hello @ostark,
I'm having the same issue. It looks like it's a dotenv loading issue. Here's what I can see in the php logs:
[06-Jun-2024 22:48:47 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Dotenv\Dotenv::__construct() must be an instance of Dotenv\Loader, string given, called in /path/to/craft/craft on line 16 and defined in /path/to/craft/vendor/vlucas/phpdotenv/src/Dotenv.php:31 Stack trace:
0 /path/to/craft/craft(16): Dotenv\Dotenv->__construct('/path/to/...')
1 {main}
thrown in /path/to/craft/vendor/vlucas/phpdotenv/src/Dotenv.php on line 31
I'm running Craft 3.9.13 and phpdotenv 3.6.
"vlucas/phpdotenv": "^3.4.0"
@JonnyBR12 @ostark
Problem fixed on my end. If you upgraded phpdotenv from 2 to 3, you also need to update the craft/craft file from:
// Load dotenv?
if (file_exists(CRAFT_BASE_PATH.'/.env')) {
(new Dotenv\Dotenv(CRAFT_BASE_PATH))->load();
}
to
// Load dotenv?
if (class_exists('Dotenv\Dotenv') && file_exists(CRAFT_BASE_PATH.'/.env')) {
Dotenv\Dotenv::create(CRAFT_BASE_PATH)->load();
}
This would be the same as the docroot's index.php file.
The required changes for dotenv are not related to the plugin. Thanks for sharing your fix.
Is there something that needs updating/removing from a Craft 3 install after upgrading to Craft 4?
We've used this plugin on a few sites (thanks!), and it works great (both Craft 3 and 4). However, on one particular site, it doesn't. When trying the test jobs, they just hang as pending and never run until we disable your plugin.
The site it doesn't run on was Craft 3, so we went through the issues on here, trying loads of different things like PHP_BINARY paths and so on, but with no success. We then upgraded to the latest version of Craft 4, and all plugins are now up-to-date. Still no joy.
Comparing the config file and PHP info with another site on exactly the same versions that does work, I can't see anything that's different or what would cause this. We've now disabled all plugins, reinstalled yours, ran composer update, rebuilt project files etc and can't get the test jobs to run successfully. There's nothing in the queue.log, web.log or other logs that I can see.
Is there anything you know of that could prevent this plugin from running? Any possible conflict? Anything in the MySQL that could be cleared?
Any help would be much appreciated.