docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.81k stars 2k forks source link

php8.2.15 removed ftp extension #1488

Open Angoll opened 8 months ago

Angoll commented 8 months ago

Hello! The update from 8.2.14 to 8.2.15 removed the ftp extension (see https://github.com/docker-library/php/commit/751276957b1d2bc317cf5033f768fe37ce24d1fa), extension that needs to be statically compiled (see https://github.com/docker-library/php/issues/236)

I believe that should not be removed in a minor upgrade. 😢 We fixed to the 8.2.14 but we would like to have minor upgrades without having to manage images from scratch.

Thanks

tianon commented 8 months ago

Hmm, I think we need to dig into the "Before PHP 7.0.0" bit of https://www.php.net/manual/en/function.ftp-ssl-connect.php, because from the docs, this should be working fine. :confused:

tianon commented 8 months ago

Ah, this is due to https://github.com/php/php-src/blob/php-8.2.15/ext/ftp/config.m4#L21-L24, but just passing --with-openssl is not enough to let it know that we do have PHP with OpenSSL support. :disappointed:

tianon commented 8 months ago

Confirmed, installing libssl-dev and invoking docker-php-ext-configure ftp --with-openssl-dir=/usr before docker-php-ext-install ftp gives me ftp_ssl_connect() successfully.

tianon commented 8 months ago

More concretely:

FROM php:8.2

RUN apt-get update && apt-get install -y libssl-dev

RUN docker-php-ext-configure ftp --with-openssl-dir=/usr \
    && docker-php-ext-install ftp
M-Arthur commented 8 months ago

Will the ftp be added back in the future Docker images?

I need to know it to decide whether to apply manual ftp installation temporarily or permanently. Thanks.

tianon commented 8 months ago

Unfortunately, we don't plan to add it back to the default set, no.

Angoll commented 8 months ago

@tianon thanks for the workaround and clarifying that is not be added back.

Is there any reason that got the package removed in the first place in a minor upgrade?

Thanks

tianon commented 8 months ago

It should've only been included in the 5.x versions in the original PR that added it (because the underlying issue was fixed in 7+) :sweat_smile:

The other option we considered was to remove it in the previous version as a normal image update (without waiting for a version change), and we opted for the slightly more conservative switch instead.

TimWolla commented 8 months ago

Confirmed, installing libssl-dev and invoking docker-php-ext-configure ftp --with-openssl-dir=/usr before docker-php-ext-install ftp gives me ftp_ssl_connect() successfully.

FWIW: I've intentionally listed the necessary steps in #1482, so that it is not necessary for someone else to research this :sweat_smile:

TE7 commented 8 months ago

More concretely:

FROM php:8.2

RUN apt-get update && apt-get install -y libssl-dev

RUN docker-php-ext-configure ftp --with-openssl-dir=/usr \
  && docker-php-ext-install ftp

Do you mind to explain how to use this solution? From what I understand I'm supposed to create Dockerfile with from/run commands. Where do I place Dockerfile and how do I call it from my Docker compose file? Can those commands be run from Ubuntu terminal and how? Thank you.

tianon commented 8 months ago

See https://docs.docker.com/compose/compose-file/compose-file-v3/#build

TE7 commented 8 months ago

See https://docs.docker.com/compose/compose-file/compose-file-v3/#build

Thank you

IronSean commented 4 months ago

More concretely:

FROM php:8.2

RUN apt-get update && apt-get install -y libssl-dev

RUN docker-php-ext-configure ftp --with-openssl-dir=/usr \
  && docker-php-ext-install ftp

When attempting this not with the php8.2 image directly but with a downstream image built on it I run into this error:

3.018 configure: error: in `/usr/src/php/ext/ftp':
3.018 configure: error: The pkg-config script could not be found or is too old.  Make sure it
3.018 is in your PATH or set the PKG_CONFIG environment variable to the full
3.018 path to pkg-config.
3.018 
3.018 Alternatively, you may set the environment variables OPENSSL_CFLAGS
3.018 and OPENSSL_LIBS to avoid the need to call pkg-config.
3.018 See the pkg-config man page for more details.
3.018 
3.018 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
3.018 See `config.log' for more details

However, running RUN docker-php-ext-install ftp right after my FROM statement listing the base image seems to be working.