# Upgrade from 3.\* to 4: stuck between PHP versions

**URL:** <https://discourse.cakephp.org/t/upgrade-from-3-to-4-stuck-between-php-versions/12659>\
**Category:** Need Help\
**Created:** [July 28, 2025, 4:10pm UTC](https://discourse.cakephp.org/t/upgrade-from-3-to-4-stuck-between-php-versions/12659 "2025-07-28T16:10:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bankai](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/bankai/32/620_2.png) [@bankai](https://discourse.cakephp.org/u/bankai)\
**Post date:** [July 28, 2025, 4:10pm UTC](https://discourse.cakephp.org/t/upgrade-from-3-to-4-stuck-between-php-versions/12659/1 "2025-07-28T16:10:31Z")

</div>

I am (finally) upgrading an old CakePHP 3.\* project to something more recent. I have installed PHP 7.4, 8.2 and 8.4 on my system. I managed to get the project to CakePHP 3.10, but the upgrade to 4.0 fails because PHP is either too old or too new:

```auto
$ php82 /var/www/composer.phar require --dev --update-with-dependencies "phpunit/phpunit:8.0.*"
./composer.json has been updated
Running composer update phpunit/phpunit --with-dependencies
Loading composer repositories with package information
Updating dependencies                           
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - cakephp/cakephp is locked to version 3.10.5 and an update of this package was not requested.
    - cakephp/cakephp 3.10.5 requires php >=5.6.0,<8.0.0 -> your php version (8.2.29) does not satisfy that requirement.
  Problem 2
    - cakephp/bake is locked to version 1.3.7 and an update of this package was not requested.
    - cakephp/bake 1.3.7 requires cakephp/cakephp >=3.4.0 <4.0.0 -> satisfiable by cakephp/cakephp[3.10.5].
    - cakephp/cakephp 3.10.5 requires php >=5.6.0,<8.0.0 -> your php version (8.2.29) does not satisfy that requirement.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

```

```auto
$ php74 /var/www/composer.phar require --dev --update-with-dependencies "phpunit/phpunit:8.0.*"
./composer.json has been updated
Running composer update phpunit/phpunit --with-dependencies
Loading composer repositories with package information
Updating dependencies                           
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - cakephp/plugin-installer is locked to version 2.0.1 and an update of this package was not requested.
    - cakephp/plugin-installer 2.0.1 requires php >=8.1 -> your php version (7.4.33) does not satisfy that requirement.
  Problem 2
    - cakephp/cakephp is locked to version 3.10.5 and an update of this package was not requested.
    - cakephp/cakephp 3.10.5 requires laminas/laminas-diactoros ^1.4.0 -> satisfiable by laminas/laminas-diactoros[1.8.7p2].
    - laminas/laminas-diactoros 1.8.7p2 requires laminas/laminas-zendframework-bridge ^1.0 -> satisfiable by laminas/laminas-zendframework-bridge[1.8.0].
    - laminas/laminas-zendframework-bridge 1.8.0 requires php ~8.1.0 || ~8.2.0 || ~8.3.0 -> your php version (7.4.33) does not satisfy that requirement.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

```

So now I’m stuck between a rock and a hard place. Any suggestions on how to resolve this? I’m a but surprised by the requirement of cakephp/plugin-installer to require PHP \>= 8.1, in the composer.json it is set like this:

```
"cakephp/plugin-installer": "*",

```

while in a newer project (generated last year with CakePHP 4) that same version is set to ^1.3.

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [July 29, 2025, 6:27am UTC](https://discourse.cakephp.org/t/upgrade-from-3-to-4-stuck-between-php-versions/12659/2 "2025-07-29T06:27:32Z")

</div>

instead of doing it via `composer require` just try to adjust your `composer.json` to the new version constraints and do a `composer update -W`
