当前位置: 首页 > news >正文

php在使用 composer 安装时报错集合

一、明明安装了扩展提示没有安装

/www/supper_admin # composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Your lock file does not contain a compatible set of packages. Please run composer update.Problem 1- lcobucci/clock is locked to version 3.3.1 and an update of this package was not requested.- lcobucci/clock 3.3.1 requires php ~8.2.0 || ~8.3.0 || ~8.4.0 -> your php version (7.4.33) does not satisfy that requirement.Problem 2- maennchen/zipstream-php is locked to version 3.1.2 and an update of this package was not requested.- maennchen/zipstream-php 3.1.2 requires php-64bit ^8.2 -> your php-64bit version (7.4.33) does not satisfy that requirement.Problem 3- phpoffice/phpspreadsheet is locked to version 1.29.10 and an update of this package was not requested.- phpoffice/phpspreadsheet 1.29.10 requires ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.Problem 4- psr/cache is locked to version 2.0.0 and an update of this package was not requested.- psr/cache 2.0.0 requires php >=8.0.0 -> your php version (7.4.33) does not satisfy that requirement.Problem 5- symfony/deprecation-contracts is locked to version v3.5.1 and an update of this package was not requested.- symfony/deprecation-contracts v3.5.1 requires php >=8.1 -> your php version (7.4.33) does not satisfy that requirement.Problem 6- symfony/event-dispatcher-contracts is locked to version v3.5.1 and an update of this package was not requested.- symfony/event-dispatcher-contracts v3.5.1 requires php >=8.1 -> your php version (7.4.33) does not satisfy that requirement.Problem 7- symfony/finder is locked to version v7.2.2 and an update of this package was not requested.- symfony/finder v7.2.2 requires php >=8.2 -> your php version (7.4.33) does not satisfy that requirement.Problem 8- symfony/service-contracts is locked to version v3.5.1 and an update of this package was not requested.- symfony/service-contracts v3.5.1 requires php >=8.1 -> your php version (7.4.33) does not satisfy that requirement.Problem 9- symfony/var-exporter is locked to version v6.4.21 and an update of this package was not requested.- symfony/var-exporter v6.4.21 requires php >=8.1 -> your php version (7.4.33) does not satisfy that requirement.Problem 10- nelexa/zip is locked to version 4.0.2 and an update of this package was not requested.- nelexa/zip 4.0.2 requires symfony/finder * -> satisfiable by symfony/finder[v7.2.2].- symfony/finder v7.2.2 requires php >=8.2 -> your php version (7.4.33) does not satisfy that requirement.To enable extensions, verify that they are enabled in your .ini files:- /usr/local/etc/php/php.ini- /usr/local/etc/php/conf.d/docker-php-ext-amqp.ini- /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini- /usr/local/etc/php/conf.d/docker-php-ext-gd.ini- /usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini- /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini- /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini- /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini- /usr/local/etc/php/conf.d/docker-php-ext-redis.ini- /usr/local/etc/php/conf.d/docker-php-ext-sodium.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-zip` to temporarily ignore these required extensions.

解决:

# 安装
composer install --ignore-platform-reqs# 添加组件
composer install <包名> --ignore-platform-reqs

–ignore-platform-reqs: ignore all platform requirements (php, hhvm, lib-* and ext-*) and force the installation even if the local machine does not fulfill these. See also the platform config option

忽略所有平台要求(php,hhvm,lib- *和ext- *)并强制安装,即使本地计算机不满足这些要求

二、多版本 PHP 下的 composer 使用

格式:

对应的php版本 composer的绝对路径 [操作]

以宝塔安装的 PHP7.4,php8.2为例子

php7.4环境下使用 composer

php74 /usr/bin/composer install

php8.2环境下使用 composer

php82 /usr/bin/composer install

三、composer 版本太低的更新

composer self-update

四、每次 composer 安装时提示 root 权限不安全

提示 “Continue as root/super user [yes]?”

vim ~/.bashrc# 把composer设置为全局
export COMPOSER_ALLOW_SUPERUSER=1
http://www.dtcms.com/a/308102.html

相关文章:

  • Jmeter 命令行压测、HTML 报告、Jenkins 配置目录
  • 材质:3D渲染的隐形支柱
  • 第二篇:Three.js核心三要素:场景、相机、渲染器
  • Linux网络-------3.应⽤层协议HTTP
  • 【运维基础】Linux 进程调度管理
  • 异步I/O和同步I/O
  • USRP捕获手机/路由器数据传输信号波形(下)
  • 金融专题|某跨境支付机构:以榫卯企业云平台 VPC 功能保障业务主体安全
  • 文档识别算法-文字识别接口-表格还原-图表文字识别API
  • HCIA-Datacom认证笔记:IP路由基础——核心概念与路由分类
  • Amazon Aurora MySQL 8.0 完整指南
  • 一些利用AIOps工具进行云原生技术持续创新的成功案例
  • Python 元编程实战:动态属性与数据结构转换技巧
  • Pycaita二次开发基础代码解析:曲面法线生成、零件加载与材料应用
  • 基于LSTM-GRU混合网络的动态解析:美联储维稳政策与黄金单日跌1.5%的非线性关联
  • AI陪伴的发展现状
  • STM32——HAL 库MDK工程创建
  • 2000-2024年中国1KM分辨率年度植被指数(NDVI、EVI)数据集
  • 万物都有属于自己的律动
  • 公路坑槽检测分析原理和思路
  • 嵌入式开发学习———Linux环境下IO进程线程学习(一)
  • 【0基础PS】Photoshop (PS) 理论知识
  • linux线程互斥和同步
  • 操作系统系统面试常问(内存、快表、相关知识)
  • 中欧建交50周年,中硼医疗领衔中意BNCT合作月,中国尖端技术出海欧洲
  • main函数,常量指针与指针常量,野指针等,void与void的区别
  • Kubernetes 应用部署实战:为什么需要 Kubernetes?
  • Apache Tomcat样例目录session操纵漏洞解读
  • Import Maps 实战指南:无需打包器,浏览器原生模块路径重映射!
  • python 检查带有标题行,以逗号为分隔符的文本文件