John Davidson

Docker fails to enable php extensions

0 comments
Message:


I am trying to install some php extensions all day but an error I do not understand occurs. Basically if I remove the install docker-php-ext-enable line everything seems to work normally (except my app that depends on them).


Dockerfile


FROM php:8.0-apache

RUN apt-get update && \
apt-get install -y unzip libcurl4-openssl-dev zlib1g-dev libpng-dev libxml2-dev libzip-dev


RUN a2enmod rewrite
RUN docker-php-ext-enable bcmath gd mysqli soap zip xml ctype curl fileinfo json

COPY idoit-1.16.2.zip /temp/idoit-1.16.2.zip
RUN unzip /temp/idoit-1.16.2.zip -d /var/www
RUN rm /temp/idoit-1.16.2.zip

COPY apache-vhost.conf /etc/apache2/sites-available/000-default.conf


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

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

EXPOSE 80

Here is what I get when i run sudo docker build -t test .


Sending build context to Docker daemon  153.9MB
Step 1/23 : FROM php:8.0-apache
---> 1157b188bd87
Step 2/23 : RUN apt-get update && apt-get install -y unzip libcurl4-openssl-dev zlib1g-dev libpng-dev libxml2-dev libzip-dev
---> Using cache
---> aacd74715e3f
Step 3/23 : RUN a2enmod rewrite
---> Using cache
---> 1ab1cd3d1228
Step 4/23 : RUN docker-php-ext-enable fileinfo
---> Running in 7d8a84075a50
error: 'fileinfo' does not exist

usage: /usr/local/bin/docker-php-ext-enable [options] module-name [module-name ...]
ie: /usr/local/bin/docker-php-ext-enable gd mysqli
/usr/local/bin/docker-php-ext-enable pdo pdo_mysql
/usr/local/bin/docker-php-ext-enable --ini-name 0-apc.ini apcu apc

Possible values for module-name:
opcache.so sodium.so

Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.

Any ideas?



My Answer:
&& apt-get install -y \
libzip-dev \
&& docker-php-ext-install zip \
&& docker-php-ext-enable zip

Rate this post

4 of 5 based on 2156 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us