Recently, while deploying a server environment, I encountered a problem caused by incompatibility of the Composer version downward. Document it.

Problem description

The back-end API application was developed using ThinkPHP6.0’s multi-application mode. When initially deployed, it was always prompted that the controller could not be found.

At that time more depressed, how can not find the controller? This exception usually only occurs when multi-application mode is not enabled and the extension is installed (Composer 2.0.x executes the Composer install without directly throwing an exception).

As I was scratching my head, I noticed that the version of Composer I am currently using is 2.0.x.

Looking back at my local version: 1.8, I googled and found that the Composer 2.0 series was only recently released, so I immediately wondered if this was the result of a downward incompatibility in Composer.

Boy, it’s really compatibility issues:

The solution

Since the version is too high caused by compatibility problems, it is easy to do, directly reduce the version can be.

Downgrading Composer is easy. You can do this without recompiling the installation:

Composer self - update 1.8.0 comes with

If you don’t know what versions are available, check out the official release history.

Refer to the link

  • ThinkPHP V6.0.5 is released — Composer2.0 compatible
  • Chinese Document of Composer