【问题标题】:unable to install mpdf无法安装 mpdf
【发布时间】:2021-10-27 00:09:28
【问题描述】:

我已经安装了 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.

有什么解决办法吗?

【问题讨论】:

  • 您好,根据documentation,自 mPDF v8.0.10 起支持 PHP 8.0。确保安装适当的版本。
  • 它就在错误消息中。需要 ext-gd * -> 您的系统中缺少它。安装或启用 PHP 的 gd 扩展。要启用扩展,请确认它们已在您的 .ini 文件中启用

标签: php xampp mpdf


【解决方案1】:

安装php8.0-gdphp8.0-mbstring

sudo apt-get install php8.0-gd php8.0-mbstring

然后用 composer 请求 mpdf 库。

composer require mpdf/mpdf v8.0.10

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-26
    • 2020-10-12
    • 1970-01-01
    • 2023-01-30
    • 2014-01-08
    • 2011-10-17
    相关资源
    最近更新 更多