缺少PHP 8.1 FPM Alpine上的EXIF扩展

发布于 2025-01-28 03:28:43 字数 1039 浏览 1 评论 0原文

我已经从php设置了PHP服务器:8.1.4-fpm-alpine3.14使用此Dockerfile

FROM php:8.1.4-fpm-alpine3.14

RUN apk update
RUN apk add --no-cache git libzip-dev zip unzip php8-exif

RUN docker-php-ext-install pdo pdo_mysql zip exif \
    && curl -sS https://getcomposer.org/installer | php -- \
    --install-dir=/usr/local/bin --filename=composer

WORKDIR /var/www/html

COPY . .

RUN chown -R www-data:www-data /var/www/html

RUN composer install

我尝试安装软件包spatie/laravel-Medialibrary:^10.0.0

问题1 - Spatie/laravel-Medialibrary [10.0.0,...,10.3.4]需要Ext-Exif * - >它缺少您的系统。安装或启用PHP的EXIF扩展。

如何解决这个丢失的问题?当我执行php -m时,我在php模块列表中找不到exif

[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

I have setup a php server from php:8.1.4-fpm-alpine3.14 using this dockerfile

FROM php:8.1.4-fpm-alpine3.14

RUN apk update
RUN apk add --no-cache git libzip-dev zip unzip php8-exif

RUN docker-php-ext-install pdo pdo_mysql zip exif \
    && curl -sS https://getcomposer.org/installer | php -- \
    --install-dir=/usr/local/bin --filename=composer

WORKDIR /var/www/html

COPY . .

RUN chown -R www-data:www-data /var/www/html

RUN composer install

I tried installing a package spatie/laravel-medialibrary:^10.0.0 and got this error

Problem 1
- spatie/laravel-medialibrary[10.0.0, ..., 10.3.4] require ext-exif * -> it is missing from your system. Install or enable PHP's exif extension.

How do I fix this missing issue? I cannot find exif in the php modules list when i execute php -m

[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凡尘雨 2025-02-04 03:28:43

您设法解决了这个问题吗?我可以看到您正在使用docker-php-ext-install添加扩展名,但您没有启用它,因此

RUN docker-php-ext-install pdo pdo_mysql zip exif \
    && docker-php-ext-enable exif \ // <----- see here
    && curl -sS https://getcomposer.org/installer | php -- \
    --install-dir=/usr/local/bin --filename=composer

如果您构建了dockerfile,则 执行此类操作(未在您的手中进行测试)再次运行php -m在容器中您会看到它已在此处列出。但是,当我尝试运行作曲家时,需要Spatie/Laravel-Medialibrary:^10.0.0至少在我的情况下,我仍然会遇到相同的错误。

更新

尝试使用安装它 - 忽略plarform-reqs param,所以

composer require "spatie/laravel-medialibrary:^10.0.0" --ignore-platform-reqs

这对我有用

Have you manage to resolve this? I can see you are using docker-php-ext-install to add the extension, but you are not enabling it, so doing something like this (not tested in your's)

RUN docker-php-ext-install pdo pdo_mysql zip exif \
    && docker-php-ext-enable exif \ // <----- see here
    && curl -sS https://getcomposer.org/installer | php -- \
    --install-dir=/usr/local/bin --filename=composer

If you build your dockerfile and then run again php -m in the container you will see it is listed there. However when I tried to run composer require spatie/laravel-medialibrary:^10.0.0 I still get the same error, at least in my case.

UPDATE

Try installing it using --ignore-plarform-reqs param, so

composer require "spatie/laravel-medialibrary:^10.0.0" --ignore-platform-reqs

This worked for me

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文