简体   繁体   中英

php7.2-openssl Alpine Docker install error

I'm building a Docker image with Alpine, php7.2-fpm and Composer.

The problem happens while trying to install Composer, which uses https to download the installer via php.

I added the repository to be able to install php7.2 (which is used to install composer) and its packages:

RUN wget -O /etc/apk/keys/phpearth.rsa.pub https://repos.php.earth/alpine/phpearth.rsa.pub && \
    echo "https://repos.php.earth/alpine/v3.7" >> /etc/apk/repositories && \
    apk update

The following error occurs when I try to download composer:

/ # php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
PHP Warning:  copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. copy() Command line code:1
PHP Warning:  copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. copy() Command line code:1
PHP Warning:  copy(https://getcomposer.org/installer): failed to open stream: No such file or directory in Command line code on line 1
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. copy() Command line code:1

Searching about this error, all I found was related do the openssl php extension.

When trying to install the php7.2-openssl extensions, I get the following error message:

/ # apk add php7.2-openssl
ERROR: unable to select packages:
  php7.2-igbinary (no such package):
    required by: world[php7.2-igbinary]
  php7.2-msgpack (no such package):
    required by: world[php7.2-msgpack]
  php7.2-readline (no such package):
    required by: world[php7.2-readline]
  so:libcrypto.so.42 (no such package):
    required by: php7.2-openssl-7.2.16-r0[so:libcrypto.so.42]
  so:libssl.so.44 (no such package):
    required by: php7.2-openssl-7.2.16-r0[so:libssl.so.44]

If I force the installation with "-f", it looks like it installed, but not really. The apk list php* --installed command does not show the openssl extension and the https request still returning the same https error.

Another way to install Composer would not be the best thing for me. Eventually I will need to use https through php anyway.

I'm using the last Alpine Docker base image version to date. Which is "3.14.2".

I wonder if it has something to do with the added repository version (3.7) compared to the image version (3.14.2).

I'd love to understand what is happening.

recently I had faced the same issue. Fixed it, by downgrading the alpine to earlier stable version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM