composer install 报错(Install or enable PHP's redis extension)

本文介绍了如何解决PHP环境中出现的redis扩展缺失问题。通过安装redis服务及对应的PHP扩展即可修复此类错误。

报错信息

 Problem 1
    - The requested PHP extension ext-redis * is missing from your system. Install or enable PHP's redis extension.

解决办法
安装并开启redis扩展

$ sudo apt-get install redis-server
$ sudo apt-get install php5-redis

其他类似的错误都可以这样解决

Installing dependencies from lock file (including require-dev) Verifying lock file contents can be installed on current platform. Your lock file does not contain a compatible set of packages. Please run composer update. Problem 1 - Root composer.json requires PHP extension ext-redis * but it is missing from your system. Install or enable PHP's redis extension. Problem 2 - endroid/qrcode is locked to version 3.6.0 and an update of this package was not requested. - endroid/qrcode 3.6.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 3 - fastknife/ajcaptcha is locked to version v1.1.5 and an update of this package was not requested. - fastknife/ajcaptcha v1.1.5 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 4 - intervention/image is locked to version 2.7.2 and an update of this package was not requested. - intervention/image 2.7.2 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. Problem 5 - league/flysystem is locked to version 1.0.69 and an update of this package was not requested. - league/flysystem 1.0.69 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. Problem 6 - mpdf/mpdf is locked to version v8.0.6 and an update of this package was not requested. - mpdf/mpdf v8.0.6 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 7 - overtrue/wechat is locked to version 4.2.20 and an update of this package was not requested. - overtrue/wechat 4.2.20 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. Problem 8 - setasign/fpdf is locked to version 1.8.4 and an update of this package was not requested. - setasign/fpdf 1.8.4 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 9 - simplesoftwareio/simple-qrcode is locked to version 4.2.0 and an update of this package was not requested. - simplesoftwareio/simple-qrcode 4.2.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 10 - symfony/translation is locked to version v6.0.0 and an update of this package was not requested. - symfony/translation v6.0.0 requires php >=8.0.2 -> your php version (7.4.0) does not satisfy that requirement. Problem 11 - symfony/translation-contracts is locked to version v3.0.0 and an update of this package was not requested. - symfony/translation-contracts v3.0.0 requires php >=8.0.2 -> your php version (7.4.0) does not satisfy that requirement. Problem 12 - cache/filesystem-adapter is locked to version 1.0.0 and an update of this package was not requested. - cache/filesystem-adapter 1.0.0 requires league/flysystem ^1.0 -> satisfiable by league/flysystem[1.0.69]. - league/flysystem 1.0.69 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. To enable extensions, verify that they are enabled in your .ini files: - E:\software\php\php.ini You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with `--ignore-platform-req=ext-redis --ignore-platform-req=ext-gd --ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.
最新发布
08-21
### 回答1: 当您在运行“composer install”命令时,如果出现错误,可能是由于以下原因之一: 1. 您的项目缺少必要的依赖项。请检查您的composer.json文件,确保所有必需的依赖项都已正确列出。 2. 您的Composer版本过旧。请尝试更新Composer并重新运行“composer install”命令。 3. 您的网络连接不稳定。请确保您的网络连接正常,并尝试重新运行“composer install”命令。 4. 您的Composer配置文件存在问题。请检查您的Composer配置文件,并确保它们正确设置。 如果您无法解决问题,请尝试搜索相关错误信息以获取更多帮助。 ### 回答2: 在使用Composer进行项目依赖管理时,可能会遇到许多错误和问题。其中之一是在运行composer install时遇到错误。 一般来说,当您运行composer install时出现错误时,它会显示错误消息,通常会包含有关问题的描述和代码位置信息。以下是几种可能的composer install错误: 1. 依赖项未找到:这通常表示的是您在composer.json文件中指定了一个依赖项,但是Composer无法找到此依赖项。您可以尝试更改版本号或使用其他源来安装此依赖项。 2.PHP版本不兼容的依赖项:某些依赖项可能需要特定的PHP版本才能正常工作。如果您的PHP版本与依赖项不兼容,则运行composer install时就会出现错误。 3. 依赖项升级导致错误:某些依赖项可能已更新,但有时它们不兼容旧版本。这可能会导致composer install命令失败。您可以尝试使用“ composer update”将所有的依赖项升级到最新版本,以解决兼容性问题。 4. 内存不足:当运行composer install时,如果您的服务器没有足够的内存来执行此操作,则可能会出现错误。您可以尝试增加您的服务器内存,或者尝试将composer install命令拆分为多个步骤。 5. 依赖项未加载:有时候在执行composer install时,依赖项可能未正确加载。您可以尝试使用“ composer dumpautoload”命令来重新加载依赖项,并查看是否解决了问题。 在解决composer install错误时,这些提示可能有所帮助。如果您无法通过这些提示解决问题,请参考composer文档或者尝试提交一个issue到composer的Github仓库中,获得更多的帮助和支持。 ### 回答3: Composer是一个PHP的依赖管理工具,它通过读取项目中的composer.json文件来下载并安装各种依赖包。但有时候执行composer install时会出现一些错误,常见的错误种类有以下几类: 1. 依赖包下载失败:当Composer尝试下载某个依赖包时,如果下载失败就会导致整个项目无法安装。这时候可以检查网络连接或者手动下载文件来解决。 2. 依赖包版本不兼容:有时候依赖包的版本与项目中其他依赖包的版本不兼容,或者版本号不符合composer.json中的要求,就会导致composer install失败。此时可以根据错误提示找到问题并手动修改composer.json,或者更新项目中的依赖包版本。 3. composer.json格式不正确:composer.json文件是使用JSON格式编写的,在编写过程中如果格式不正确,就会导致Composer无法正确读取文件中的配置信息。修复方法就是检查composer.json文件语法是否正确,并纠正错误。 4. Composer配置不正确:有时候在执行composer install时会遇到权限或其他配置问题。这时候需要检查Composer及其依赖包的正确安装、用户权限、Composer配置等问题来排查。 以上仅是composer install报错的一些常见情况,实际情况还需要具体问题具体分析,可以根据错误提示或者日志来定位问题并解决。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值