• Resolved letterafterz

    (@letterafterz)


    php-error: Array ( [type] => 2 [message] => file_get_contents(/web/app/plugins/feeds-for-youtube/.env): Failed to open stream: No such file or directory

    I’m getting the above error when trying to use the plugin. Adding a blank .env file to the plugin folder solves the issue.

    The issue appears to be this line in bootstrap.php which is attempting to load the .env file in the root.

    //Load .env variables
    if (class_exists('Dotenv\Dotenv') && method_exists('Dotenv\Dotenv', 'createImmutable')) {
    $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
    $dotenv->safeLoad();
    }

    My recommendation would be to alter this code so it fails more gracefully if there isn’t a .env file available to the plugin, rather than just checking if dotenv exists, e.g:

    //Load .env variables
    if (class_exists('Dotenv\Dotenv') && method_exists('Dotenv\Dotenv', 'createImmutable')) {
    $dotenv_path = __DIR__ . '/.env';
    if (file_exists($dotenv_path)) {
    $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
    $dotenv->safeLoad();
    }
    }

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Plugin Support Smash Balloon Nigel

    (@nigelrsb)

    Hi @letterafterz

    Thank you for bringing this to our attention. I just wanted to let you know that I’m working on this.

    I am checking with my colleagues to get more details on this.?I’ll get back to you as soon as I have an update; thank you in advance for your patience.?If you have any additional thoughts or questions in the meantime, please let me know.?

Viewing 1 replies (of 1 total)
  • The topic ‘PHP error – plugin trying to load .env file’ is closed to new replies.