由于dompdf

时间:2018-06-10 10:08:55

标签: laravel docker composer-php dompdf laravel-cashier

项目使用docker php:7.1-fpm图像来运行我的laravel应用程序 通过prooph / composer:7.2安装laravel / cashier时,会抛出错误:

Problem 1
- laravel/cashier v7.1.0 requires dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0, v0.8.1, v0.8.2].
- laravel/cashier v7.1.1 requires dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0, v0.8.1, v0.8.2].
- dompdf/dompdf v0.8.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dompdf/dompdf v0.8.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dompdf/dompdf v0.8.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- Installation request for laravel/cashier ^7.1 -> satisfiable by laravel/cashier[v7.1.0, v7.1.1].

To enable extensions, verify that they are enabled in your .ini files:
- /usr/local/etc/php/php.ini
- /usr/local/etc/php/conf.d/amqp.ini
- /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
- /usr/local/etc/php/conf.d/docker-php-ext-intl.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-pdo_pgsql.ini
- /usr/local/etc/php/conf.d/docker-php-ext-soap.ini
- /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
- /usr/local/etc/php/conf.d/mongodb.ini
- /usr/local/etc/php/conf.d/php7.ini
- /usr/local/etc/php/conf.d/redis.ini
- /usr/local/etc/php/conf.d/zmq.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.


这是我的dockerfile内容:

FROM php:7.1-fpm

RUN echo "deb http://www.deb-multimedia.org jessie main" >> /etc/apt/sources.list &&\
curl -L http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb -o /deb-multimedia-keyring.deb &&\
dpkg -i /deb-multimedia-keyring.deb

RUN apt-get update && apt-get install -y \
libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev cron libcurl3 imagemagick libav-tools python

RUN docker-php-ext-configure mcrypt && \
docker-php-ext-install -j$(nproc) iconv mcrypt pdo_mysql opcache && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install -j$(nproc) gd

RUN echo "* * * * * root php /var/www/tidytide/artisan schedule:run &> /var/log/cron.artisan" >> /etc/crontab

WORKDIR /var/www/tidytide

COPY --chown=www-data:www-data . .

COPY ./entrypoint.sh /

ENTRYPOINT /entrypoint.sh


问题是收银员需要dompdf包,这需要在php上启用gd库。 GD库是通过dockerfile安装的,因为我看到dompdf没有观察到这一点。

1 个答案:

答案 0 :(得分:0)

如果您使用不同的容器(和不同的PHP版本)进行作曲家安装,您应该使用composer.json中的platform设置来模拟实际运行应用程序的容器配置:< / p>

"config": {
    "platform": {
        "php": "7.1",
        "ext-gd": "*"
    }
},

Composer的行为就像你正在使用启用了GD扩展的PHP 7.1,即使你实际使用的是没有这个扩展的PHP 7.2来运行Composer。