I’m deploying my web project (Laminas Framework with Composer) on Amazon AWS on EC2 instance running Ubuntu 23 with PHP8.1. Everything works fine before using Redis server for caching datas (sessions, translations files, etc.). On my local machine, everything works but when I deploy it on the EC2 instance, I get this error :
I tried but it does not work. I get the same error message
Package laminas/laminas-cache-storage-adapter-redis has requirements incompatible with your PHP version, PHP extensions and Composer version:
- laminas/laminas-cache-storage-adapter-redis 2.5.0 requires ext-redis ^4.3 || ^5.0.2 which does not match your installed version 6.0.0-dev.
Its not per-say the package versions that is causing the composer issue from what it looks like its the ext-redis version itself that is causing your issue.
Since there is an entry for the ext-redis version composer is going to verify that its correct. Just like it will for your php version. As I understand it.
Since it uses ^5.0.2 but its finding 6.0.0-dev it will not accept it because its a major version change. ^ will allow a bump in minor, but not in major. If I understand it correctly.
So, the question becomes where and how is the ext-redis 6.0.0-dev version being used instead of a stable 5.* version since the package can use that.
Can you share your composer.json file content? I hope it doesn’t have any FBI secrets in it or any stock trade confidential information. If not please share it.
Is there a way in the EC2 configuration to specify which version of ext-redis is used? I’m not sure why a -dev version would be used there. Seems real bleeding edge to me for a production environment…
@ALTAMASH80 The composer.json that is causing the issue is the one from the storage adapter I linked to in my previous post. His issue (I think) is because for whatever reason his EC2 instance is using a ext-redis v6.0.0-dev (which I have not figured out how is possible, unless its a custom thing for AWS, which they do from time to time). – Edit – Might have found it. See below for the AWS link.
@ebuddy
I think your core issue is going to be because of this:
Maybe. But there is most likely what is supplying your 6.0.0 version.
Also, its not that ext-redis is missing. The issue is that composer is finding the wrong version.
You might want to try deploying it with this version specified:
SInce your composer constraint will allow patches and minor bumps. That “should” work. Then the next question is if the laminas adapter will play nice. Honestly, I do not know enough about it to even guess if it will work even if the install proceeds. But it might very well fix your composer issue. Which is the only thing I am addressing.
If that is not possible. You could also see this link and it explains how to ignore that constraint
Check your Redis version. If it outputs v6.0.0-dev. It means you need to downgrade your Redis version. To check the Redis version you can see this link.
@ebuddy ,
Damn! You’re using the windows cancer operating system for PHP development. I don’t know why I assumed you’re using some Linux version. For Windows, I’ve no clue how to resolve your issue. But what I can say is that you may need to downgrade your Redis cache version or install version 5 of Redis on your system. For that, you may need to uninstall the current Redis version 3.
@ALTAMASH80
Keep in mind, that the issue referenced is only happening when he deploys to AWS. That was the issue. Not what is installed on his local. It works there as he previously stated.