I decided to edit the existing Dockerfile to update the PHP version of the development environment from 7.2.11 to 7.4.x.
Update the PHP version of the development environment (Docker) from 7.2.11 to 7.4.x.
# Dockerfile
#↓ 7 this.4.I want to x
FROM php:7.2.11-apache
RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip
Eventually it became this shape.
# Dockerfile
FROM php:7.4.13-apache
RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libzip-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip
Looking at Docker Hub, I had an image of 7.4.13-apache
, so I changed it for the time being.
# Dockerfile
# ↓7.4.Changed to 13
FROM php:7.4.13-apache
RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip
However. .. ..
$ docker-compose build
...
Abbreviation
...
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
No package 'libzip' found
No package 'libzip' found
No package 'libzip' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: Service 'service_name' failed to build : The command '/bin/sh -c apt-get update && apt-get install -y zlib1g-dev && docker-php-ext-install zip && apt-get install -y unzip' returned a non-zero code: 1
There seems to be no such thing as libzip
...
So I added apt-get install libzip-dev
.
FROM php:7.4.13-apache
# zlib zip unzip
RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& apt-get install libzip-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip
Then ...
$ docker-compose build
...
Abbreviation
...
The following package was automatically installed and is no longer required:
sensible-utils
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
libzip4
The following NEW packages will be installed:
libzip-dev libzip4
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 209 kB of archives.
After this operation, 436 kB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
Does that mean there is no -y
option?
so,
# Dockerfile
FROM php:7.4.13-apache
RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libzip-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip
Add the -y
option and run $ docker-compose build
again.
$ docker-compose build
...
Abbreviation
...
Successfully built ******
Successfully tagged app_name:latest
I did well! !!
stack oveflow Installing PHP-zip on a php:7.4-fpm image