1

I've been running into some problems upgrading my server from PHP7.3 to PHP8.0, so I figured I'd list what I've found and ask if anyone else has a better solution.

The Problem I'm running into: I've got a PHP Laminas application that uses the laminas/laminas-cache package in composer.json; the problem is that it has several dependancies that are NOT compatible with PHP8 (also, several of the dependencies are abandoned), so I get errors like this:

- laminas/laminas-cache-storage-adapter-apc[1.0.0, ..., 1.0.1] require php ^5.6 || ^7.0 -> your php version (8.0.9) does not satisfy that requirement.
- laminas/laminas-cache 2.13.0 requires laminas/laminas-cache-storage-adapter-apc ^1.0 -> satisfiable by laminas/laminas-cache-storage-adapter-apc[1.0.0, 1.0.1].
- Root composer.json requires laminas/laminas-cache ^2.13 -> satisfiable by laminas/laminas-cache[2.13.0].

It looks like laminas/laminas-cache 3.0 will solve a bunch of the dependency problems, but it's still in a Dev state, so it's considered too unstable for my production environment. Which means that I've got to use laminas/laminas-cache 2.13.

How to fix it: It took me a while to find this documentation, but as far as I can tell you're supposed to pick-and-choose which dependencies you want to ignore by putting them in a Replace section:

https://github.com/laminas/laminas-cache/issues/88

And here is the standard list of packages to "replace:"

"replace": {
    "laminas/laminas-cache-storage-adapter-apc": "*",
    "laminas/laminas-cache-storage-adapter-dba": "*",
    "laminas/laminas-cache-storage-adapter-mongodb": "*",
    "laminas/laminas-cache-storage-adapter-wincache": "*",
    "laminas/laminas-cache-storage-adapter-xcache": "*",
    "laminas/laminas-cache-storage-adapter-zend-server": "*"
},

Once I've copy/pasted that section into composer.json it allows me to successfully run composer update without it throwing a fit, but I'm not a huge fan of having a bunch of packages replaced with with "*" version wildcard.

So... my question is: Is there a better a way to do this, or have I stumbled onto the best solution until laminas/laminas-cache 3.0 is complete?

2
  • If this is the documented way of using it, do it :)
    – Nico Haase
    Aug 31, 2021 at 5:36
  • Sounds good! I'm still pretty new to Composer stuff, so I wanted a 2nd opinion. Thanks for the help! Aug 31, 2021 at 14:21

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.