There are cases where, on our platform, a PHP error indicate a class is missing. Usually a cache clear with Drush will put things back in order. There are cases when Drush is unable to operate, either, and will return an Uncaught Error:
PHP Fatal error: Uncaught Error: Class 'Symfony\Component\Console\Output\StreamOutput' not found in /mnt/www/html/example/vendor/drush/drush/src/Preflight/PreflightLog.php:15
It may be working locally, however. If that's the case, the cause could be a PHP file that is not included (or which is ignored) in your Git repository.
Using the example above, we were able to find the file locally using the following command:
find . -name StreamOutput.php
Through that we were able to find that the local file path was ./vendor/symfony/console/Output/StreamOutput.php
Using that output, at the root of your repository, (that is, above the docroot folder), run this command:
git check-ignore -v ./vendor/symfony/console/Output/StreamOutput.php
That will either output nothing (meaning .gitignore
is not responsible), or it will return something like this:
.gitignore:31:console ./vendor/symfony/console/Output/StreamOutput.php
The first bit tells us that the .gitignore
file is at play here, and that on line 31, there's a reference to the console
folder. To rectify this, we edited the .gitignore
file, removed line 31, added the file or directory to the repository, commit it, and push it to your environment using our code workflow.
Sometimes, we have seen Mac Git case problems, where the missing class was Index (
which would mean the PHP file name is Index.php
) but the file index.php
has been ignored, and the combination of the .gitignore
file and the case problems led to a class not found error. Removing that line solved the problem.