1

My website is running Drupal 8.8.x When upgrading to Drupal 8.9.x and then running 'composer install' on production everything seems to install as expected but the site then goes offline with a 500 error and running any Drush command outputs the below text. I suspect it may be an issue with something in my composer.json file but I have no idea what it could be. I have dozens of other similar Drupal sites and none have this issue.

I've spent a couple of days trying to figure out the cause or a fix without look. Any suggestions?

PHP Warning:  require(/home/WEBSITE/public_html/vendor/composer/../../load.environment.php): failed to open stream: No such file or directory in /home/WEBSITE/public_html/vendor/composer/autoload_real.php on line 73


PHP Warning:  require(/home/WEBSITE/public_html/vendor/composer/../../load.environment.php): failed to open stream: No such file or directory in /home/WEBSITE/public_html/vendor/composer/autoload_real.php on line 73


 PHP Fatal error:  require(): Failed opening required '/home/WEBSITE/public_html/vendor/composer/../../load.environment.php' (include_path='/home/WEBSITE/public_html/vendor/pear/pear_exception:/home/WEBSITE/public_html/vendor/pear/console_getopt:/home/WEBSITE/public_html/vendor/pear/pear-core-minimal/src:/home/ntgitc                                om/public_html/vendor/pear/archive_tar:.:/opt/alt/php73/usr/share/pear') in /home/WEBSITE/public_html/vendor/composer/autoload_real.php on line 73

1 Answer 1

1

Your composer.json probably has this in it (many do):

"autoload": {
  "files": [
    "load.environment.php"
  ]
}

But you don't have load.environment.php present in the file system.

Either remove the line from composer.json if you don't need to use dotenv, or add the file which typically contains something like this:

<?php
/**
 * This file is included very early. See autoload.files in composer.json and
 * https://getcomposer.org/doc/04-schema.md#files
 */
use Dotenv\Dotenv;
use Dotenv\Exception\InvalidPathException;
/**
 * Load any .env file. See /.env.example.
 */
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->safeLoad();
1
  • Thank you. It wasn't that exactly but led me to the solution of removing all references to 'autoload' in my composer.json. Thanks! Commented Jun 24, 2020 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.