How'd I enable a PHP module in official php:php-fpm docker image? Cannot install php-zip for instance:
root#122f1612f817:/var/www/html# apt-cache policy php-zip
php-zip:
Installed: (none)
Candidate: (none)
Version table:
2:7.3+69 -1
500 http://deb.debian.org/debian buster/main amd64 Packages
root#122f1612f817:/var/www/html# apt-get install php-zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php-zip is a virtual package provided by:
php7.3-zip 7.3.4-2 [Not candidate version]
E: Package 'php-zip' has no installation candidate
You can install it as a PHP extension as it seems from the logs it not available in the repo.
FROM php:7.2-fpm
RUN apt-get update
RUN apt-get install libzip-dev -y
RUN docker-php-ext-configure zip --with-libzip \
&& docker-php-ext-install zip
add line to Dockerfile
RUN apt-get install php-zip -y
php-zip for PHP >= 7.3
RUN apt-get install -y \
libzip-dev \
zip \
&& docker-php-ext-install zip
Related
I've getting started with Docker, using the LAMP repo from GitHub as my starting point. I need to add the libxslt lib. I've tried adding this to my Dockerfile:
RUN apt-get install libxslt-dev
RUN docker-php-ext-enable libxslt-dev
But keep getting error: E: Unable to locate package libxslt-dev
I've tried to search for the lib from the Docker container's command line apt-cache search libxslt but get no results.
Can anybody point me in the right direction to get this lib installed?
Thanks
Followed answer below (#vpalmerini) updating Dockerfile:
RUN apt update && apt-get install -y libxslt-dev
RUN docker-php-ext-enable libxslt-dev
Which I thought was working:
Step 9/13 : RUN apt update && apt-get install -y libxslt-dev
[...]
The following additional packages will be installed:
libxslt1.1
The following NEW packages will be installed:
libxslt1-dev libxslt1.1
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 756 kB of archives.
After this operation, 3001 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 libxslt1.1 amd64 1.1.32-2.2~deb10u1 [237 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 libxslt1-dev amd64 1.1.32-2.2~deb10u1 [519 kB]
Fetched 756 kB in 0s (4903 kB/s)
Selecting previously unselected package libxslt1.1:amd64.
(Reading database ... 21271 files and directories currently installed.)
Preparing to unpack .../libxslt1.1_1.1.32-2.2~deb10u1_amd64.deb ...
Unpacking libxslt1.1:amd64 (1.1.32-2.2~deb10u1) ...
Selecting previously unselected package libxslt1-dev:amd64.
Preparing to unpack .../libxslt1-dev_1.1.32-2.2~deb10u1_amd64.deb ...
Unpacking libxslt1-dev:amd64 (1.1.32-2.2~deb10u1) ...
Setting up libxslt1.1:amd64 (1.1.32-2.2~deb10u1) ...
Setting up libxslt1-dev:amd64 (1.1.32-2.2~deb10u1) ...
Processing triggers for libc-bin (2.28-10) ...
Removing intermediate container b62504aca3f9
---> b62b7af34467
Step 10/13 : RUN docker-php-ext-enable libxslt-dev
---> Running in 181191c74fe5
error: 'libxslt-dev' does not exist
Also tried changing RUN command to match package found: libxslt1-dev
RUN docker-php-ext-enable libxslt1-dev
Still unable to enable libxslt
Further info, output from:
dpkg --get-selections
includes:
libxml2-dev:amd64 install
libxrender-dev:amd64 install
libxrender1:amd64 install
libxslt1-dev:amd64 install
libxslt1.1:amd64 install
libxt-dev:amd64 install
But running RUN docker-php-ext-enable libxslt1-dev still gives
error: 'libxslt1-dev' does not exist
You are confusing the php extension called xsl with the system development package for libxslt (present on your base image Debian Linux distribution with the specific name libxslt1-dev) which is required to install that php extension.
Here is a basic Dockerfile to achieve your requirement. Note that, as a good practice, I made the install in a single run instruction with some extra cleanup at the end.
The apt-get remove line is optional but will reduce the layer size a bit more. Installing libxslt1-dev and all its dependencies (icu-devtools, libicu-dev, libicu63, libxml2, libxml2-dev, libxslt1.1) is mandatory for installing the extension. But once it is done, the dev packages can be removed.
FROM php:7.4.2-apache-buster
RUN apt-get update && \
apt-get install -y libxslt1-dev && \
docker-php-ext-install xsl && \
apt-get remove -y libxslt1-dev icu-devtools libicu-dev libxml2-dev && \
rm -rf /var/lib/apt/lists/*
The only thing missing is that you have to update the packages of your image, then you will be able to install libxslt-dev package:
RUN apt update && apt-get install -y libxslt-dev
I'm not able to install mongodb extension using php:5.6-fpm image.
What's wrong with my Dockerfile configuration ?
FROM php:5.6-fpm
RUN apt-get update \
&& mkdir -p /usr/share/man/man1 \
&& mkdir -p /usr/share/man/man7 \
&& apt-get install -y --no-install-recommends vim curl debconf subversion git apt-transport-https apt-utils \
build-essential locales acl mailutils wget zip unzip htop vim \
gnupg gnupg1 gnupg2 \
libmemcached-dev zlib1g-dev \
libcurl4-openssl-dev pkg-config libssl-dev libicu-dev g++
RUN docker-php-ext-configure intl
RUN docker-php-ext-install pdo pdo_mysql zip intl
RUN pecl install mongodb
RUN docker-php-ext-enable mongodb
COPY php.ini /usr/local/etc/php/conf.d/php.ini
...
...
I have the following error when executing docker-compose build
Step 5/18 : RUN pecl install mongodb
---> Running in 5cd13b1b969c
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/mongodb requires PHP (version >= 7.0.0, version <= 7.99.99), installed version is 5.6.40
No valid packages found
install failed
Solution:
RUN pecl install mongodb-1.7.4
I am using Linux Mint 19.1. My PHP configuration is like below
I am getting below error while I am trying to install mcrypt.
Try out using these commands
To install the dependencies :
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install php7.2-dev
sudo apt-get -y install libmcrypt-dev
Once the dependencies have been installed, you can install mcrypt with the command:
sudo pecl install mcrypt-1.0.1
I have been unable to get soap to work with my php Docker setup.
I am using Docker CE for Windows Version 18.03.1-ce-win65 (17513). PHP version 7.2.3
I've tried running from inside the container apt-get install php-soap which results in
Reading package lists... Done
Building dependency tree
Reading state information... Done*
Package php-soap is a virtual package provided by:
* php7.0-soap 7.0.27-0+deb9u1 [Not candidate version]*
E: Package 'php-soap' has no installation candidate
Running docker-php-ext-install soap
results in the error configure: error: libxml2 not found. Please check your libxml2 installation.
However when looking at php info I see the following:
libxml2 Version => 2.9.4
You will need to install libxml2-dev as part of your dockerfile, the image is kept to a minimum and doesn't include all of the bits needed by every module. Although the image may have the main package, the -dev package includes the components needed to compile other modules which rely on it...
RUN apt-get update && \
apt-get install -y libxml2-dev
(From https://github.com/docker-library/php/issues/315)
Just to make it clear - the command
RUN docker-php-ext-install soap
will then run successfully to install the soap library.
For me, working with PHP 7.3.2, the other solutions didn't work.
Both "php-soap" and "php7.3-soap" got "phpXXX-soap has no installation candidate" error.
Alone "docker-php-ext-install soap" wanted the "libxml2-dev" so i just installed the necessities:
FROM php:7.3
RUN apt-get update -y \
&& apt-get install -y \
libxml2-dev \
&& apt-get clean -y \
&& docker-php-ext-install soap
... and it worked nicely.
The correct answer was done, but for me, I needed also to enable (docker-php-ext-enable soap) the soap module, so for If someone could be useful:
FROM php:7.4.24-apache
# your configurations ...
RUN apt-get update && \
apt-get install -y libxml2-dev
RUN docker-php-ext-install soap && docker-php-ext-enable soap
# other configurations ...
This is outside the scope of this repo.
You should get it via this approach:
RUN apt-get update -y \
&& apt-get install -y \
libxml2-dev \
php-soap \
&& apt-get clean -y \
&& docker-php-ext-install soap
I am at the initial stages of preparing for multiphp nginx following a complete install of Ubuntu and the git page
http://phpbrew.github.io/phpbrew/
I have duplicated steps followed here for clarity and re-installed Ubuntu and followed exactly what is below in case my error correction attempts were causing issues
https://docs.google.com/spreadsheets/d/1KbfqW5PqFejlCMV9yEUHgEr5FdCh5P6Ufv-HRQH3u9g/edit?usp=sharing
but fails with /usr/bin/env: php: No such file or directory.
Please check out our wiki and install the requirements
https://github.com/phpbrew/phpbrew/wiki/Requirement
apt-get build-dep php5
apt-get install -y php5 php5-dev php-pear autoconf automake curl libcurl3-openssl-dev build-essential libxslt1-dev re2c libxml2 libxml2-dev php5-cli bison libbz2-dev libreadline-dev
apt-get install -y libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev
apt-get install -y libssl-dev openssl
apt-get install -y gettext libgettextpo-dev libgettextpo0
apt-get install -y libicu-dev
apt-get install -y libmhash-dev libmhash2
apt-get install -y libmcrypt-dev libmcrypt4
I did not post this without much effort trying to resolve first - about a day and many visited links.
Anyway the issue lay with thinking php was installed with Ubuntu +/ updates.
Note that phpbrew has php as one of its dependencies.
I guess a fresh OS install went against me on this occasion.
sudo apt-get install php5