New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block the installation of Debian's PHP packages #542

Merged
merged 2 commits into from Dec 14, 2017

Conversation

Projects
None yet
10 participants
@tianon
Member

tianon commented Dec 14, 2017

This will hopefully help folks with the confusion around installing packages like "php-apcu" and then wondering why they don't actually "work" (because they pull in Debian's PHP, and that's not what this image packages).

Block the installation of Debian's PHP packages
This will hopefully help folks with the confusion around installing packages like "php-apcu" and then wondering why they don't actually "work" (because they pull in Debian's PHP, and that's not what this image packages).
@tianon

This comment has been minimized.

Member

tianon commented Dec 14, 2017

The suggested workaround for users who know what they're doing and are crazy enough to want two copies of PHP in their images would be to simply remove this file.

@tianon

This comment has been minimized.

Member

tianon commented Dec 14, 2017

For Google's sake, here's what this looks like when a user tries to install something that doesn't make sense in this image:

root@212b2ae4fcdd:/# apt-get install php-apcu
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php-apcu is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php-apcu' has no installation candidate

root@212b2ae4fcdd:/# apt-cache policy php-apcu
php-apcu:
  Installed: (none)
  Candidate: (none)
  Version table:
     5.1.8+4.0.11-1 -1
        500 http://deb.debian.org/debian stretch/main amd64 Packages

@yosifkit yosifkit merged commit 79436c8 into docker-library:master Dec 14, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@yosifkit yosifkit deleted the infosiftr:no-debian-php branch Dec 14, 2017

tianon added a commit to infosiftr/stackbrew that referenced this pull request Dec 18, 2017

Update docker-library images
- `docker`: 17.12.0-ce-rc3
- `julia`: 0.6.2
- `percona`: 5.7.20
- `php`: block install of Debian `php` (docker-library/php#542)
- `python`: add Alpine 3.7 variants (docker-library/python#249), update Alpine thread stack size (docker-library/python#248)
- `redmine`: fix over-aggressive `chmod` (docker-library/redmine#98)
@PanMan

This comment has been minimized.

PanMan commented Dec 22, 2017

This also prevents our php-imagick from installing, which worked before :(.

@tianon

This comment has been minimized.

Member

tianon commented Dec 22, 2017

@PanMan it likely installed, but couldn't/shouldn't have been actually working with the proper PHP installation -- you likely got Debian's PHP instead, and simply didn't notice the swap

You want to install imagick from PECL instead: https://pecl.php.net/package/imagick

@mstenta

This comment has been minimized.

mstenta commented Dec 31, 2017

I need to install phpunit and php5-geos in my image. What is the recommended approach to doing so now? GEOS was working for me before. Now it's causing build errors on Docker hub: farmOS/farmOS#49

@mstenta

This comment has been minimized.

mstenta commented Dec 31, 2017

Let's focus discussion in this new issue: #551

@tianon

This comment has been minimized.

Member

tianon commented Jan 4, 2018

See docker-library/docs#1111 for a documentation PR which explains the reasons for the change, the intended behavior, the workaround, and the proper fix.

@gitowiec

This comment has been minimized.

gitowiec commented Jan 13, 2018

I want to install php-xdebug from here https://packages.sury.org/php/dists/jessie/main/binary-amd64/,
Why this packages got blocked?

@gary-harpaz

This comment has been minimized.

gary-harpaz commented on dbd5d1e Jan 14, 2018

This change broke our images which extend php image. All packages like: php5-gd, php5-soap etc.. where not found by apt-get.

This comment has been minimized.

phy25 replied Jan 15, 2018

@gary-harpaz See readme and #542 for more information, thank you

@yosifkit yosifkit referenced this pull request Jan 31, 2018

Closed

How to install php-fpdf? #577

pierrecdn added a commit to pierrecdn/phpipam that referenced this pull request Feb 8, 2018

Unbreak debian PHP packages install
library/php guys decided to break Debian PHP packages installation as per
docker-library/php#542.

This is a quick workaround to unblock the image build, but in the mid-run it
would be better to rethink the whole image build, using alpine, pecl installs,
eventually PHP7, etc.

Signed-off-by: pierrecdn <me@pierre-cheynier.net>
@zerho

This comment has been minimized.

zerho commented Oct 23, 2018

The point for blocking the install is really clear but sorry what is not clear is the proper way that you suggest to install the different modules

@yosifkit

This comment has been minimized.

Member

yosifkit commented Oct 23, 2018

@zerho, that depends on the extension that you need. We have a whole section in the Docker Hub docs that show different ways to install extensions: https://github.com/docker-library/docs/tree/5c5113376819629b6cc856de8ae1133e4c978bf0/php#how-to-install-more-php-extensions. Those use the scripts that we provide docker-php-ext-install, docker-php-ext-configure, and docker-php-ext-enable. You can see what is already enabled with php -m, and you can see the other core extensions available in the help output:

$ docker run -it --rm php:7.2 docker-php-ext-install
usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
   ie: /usr/local/bin/docker-php-ext-install gd mysqli
       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop

if custom ./configure arguments are necessary, see docker-php-ext-configure

Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip

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

If you can live with the version of PHP in Debian or Ubuntu so that you can just install packages like php5-gd from apt, then you don't need the php image and can just build FROM the Debian or Ubuntu version of your choice.

@PeterBocan

This comment has been minimized.

PeterBocan commented Oct 25, 2018

Yeah, the I'm currently trying to install "http" extension into the PHP and I am already 4 hours into this nightmare.

@wglambert

This comment has been minimized.

wglambert commented Oct 25, 2018

@PeterBocan Here you go, you should add in specific versions for the packages

FROM php

RUN apt-get update; \
        apt-get install -y --no-install-recommends libssl-dev zlib1g-dev libcurl3-dev; \
        pecl install propro raphf; \
        docker-php-ext-enable propro raphf; \
        apt-get purge -y --auto-remove

RUN pecl install pecl_http; \
        docker-php-ext-enable http
$ docker build . -t php:test
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM php
 ---> df1b7c730f91
Step 2/3 : RUN apt-get update;  apt-get install -y --no-install-recommends libssl-dev zlib1g-dev libcurl3-dev;  pecl install propro raphf;      docker-php-ext-enable propro raphf;     apt-get purge -y --auto-remove
 ---> Using cache
 ---> 8431c5cdaec1
Step 3/3 : RUN pecl install pecl_http;  docker-php-ext-enable http
 ---> Using cache
 ---> 08796fc74ade
Successfully built 08796fc74ade
Successfully tagged php:test

$ docker run --rm php:test php -m | grep http 
http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment