The shop stopped working immediately after running composer update. White screen or 500 error on the front and admin, logs full of PHP Fatal Error messages. Resolution time: 2 hours.
Symptoms
- HTTP 500 on every page of the shop and admin panel
- In
var/log/exception.log:PHP Fatal error: Cannot declare class X, because the name is already in use - Or:
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0" - Problem appeared immediately after
composer update
Cause
The update bumped a library version that required a higher PHP version than installed on the server. Alternatively: two modules installed the same class in different versions causing an autoloader conflict.
Solution
# Check logs tail -100 var/log/exception.log tail -100 var/log/system.log # Check PHP version php -v # Check Composer requirements composer check-platform-reqs # Revert to previous state git stash # if vendor was in git # or composer install # restores from composer.lock # Update selectively instead of "update all" composer update magento/module-catalog --with-dependencies # Before any update test on staging: composer update --dry-run
Takeaways
Never run composer update without --dry-run on production. Always check composer check-platform-reqs after an update. A staging environment is mandatory before any update.
