我已经安装了 Composer,现在我正在尝试在我的项目文件夹中安装 mpdf。 我执行了以下命令
composer require mpdf/mpdf
。之后我收到以下错误:
Using version ^8.0 for mpdf/mpdf
./composer.json has been created
Running composer update mpdf/mpdf
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- mpdf/mpdf[v8.0.0, ..., v8.0.3] require php ^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 -> your php version (8.0.7) does not satisfy that requirement.
- mpdf/mpdf[v8.0.4, ..., v8.0.7] require php ^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 -> your php version (8.0.7) does not satisfy that requirement.
- mpdf/mpdf[v8.0.8, ..., v8.0.9] require php ^5.6 || ^7.0 -> your php version (8.0.7) does not satisfy that requirement.
- mpdf/mpdf[v8.0.10, ..., v8.0.12] require ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
- Root composer.json requires mpdf/mpdf ^8.0 -> satisfiable by mpdf/mpdf[v8.0.0, ..., v8.0.12].
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, deleting ./composer.json.
有什么解决办法吗?
我正在使用 mpdf 8.1.2(Windows 11 家庭单语言上的 PHP 8.1.6、CodeIgniter 4.2.6)并遇到同样的问题。可以通过以下2步解决:
安装
php8.0-gd
和php8.0-mbstring
sudo apt-get install php8.0-gd php8.0-mbstring
然后需要
mpdf
库和作曲家。
composer require mpdf/mpdf v8.0.10
先生,我使用 php 版本 8.2.12 也有同样的问题
我收到此消息,如何修复它 C:\xampp\htdocs\Ghazniwal\pages>composer 需要 mpdf/mpdf v8.1.0 -w ./composer.json 已创建 运行composer update mpdf/mpdf --with-dependencies 加载包含包信息的 Composer 存储库 更新依赖项 您的要求无法解析为一组可安装的软件包。
问题1 - 根composer.json需要mpdf/mpdf v8.1.0 -> 可满足mpdf/mpdf[v8.1.0]。 - mpdf/mpdf v8.1.0 需要 php ^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 -> 你的 php 版本 (8.2.12) 不满足该要求。
安装失败,正在删除./composer.json。