Contao: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0

This is an archive post. It will not be updated.

Recently, after upgrading a project to Contao 4.9, I stumbled across a problem that was very confusing at first:

On the web space there was a Contao installation that contained several websites. The main website ran perfectly after the update. A small website (mind you, in the same Contao installation), however, showed the following message when you called up the domain:

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0

I was very confused, since the main website ran without any problems. To be on the safe side, I checked the PHP info in the Contao Manager again. It said, just like the admin panel of the server, that a PHP 7.4.x version higher than the one required in the error message was set.

As I simply couldn’t make sense of it, I asked the shining hero of all despairing Contao admins for help: Xtra.

Luckily, he quickly put me on the right track:

He asked whether I had ever called up the Contao Manager under the domain of this small project. I said no, because I had already been in via the domain of the big project (which was set up on the same Contao installation). On his advice, I did that and lo and behold, there was a very clear error message right away:

vendor/bin/contao-console contao:version
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.2.34. in /var/www/XXXXX/vendor/composer/platform_check.php on line 24

Now I was even more confused, but then he pointed out to me that a different PHP version had surely been set at the web host for this domain than for the main project. Yup, that was it. I had been so fixated on the fact that it was the same web space that I had completely forgotten that the alias domain (vHost) has its own settings at the web host.

So I quickly logged in to the server’s admin panel, selected the correct PHP version and also copied over all the other directives from the main domain. Voilà, everything ran like clockwork.