skip to Main Content

I apologise if this is a duplicate, but none of the already posted question’s answers helped me.

Recently, the Dockerfile for our php5.6-apache doesn’t want to build anymore. The line where it fails is when imagick is trying to be installed via pecl.

# Enable imagick
RUN apt-get update && apt-get install -y libmagickwand-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN yes '' | pecl install -vvv imagick-beta

Running this line fails due to the following error:

 > [12/25] RUN yes '' | pecl -vvv install imagick-beta:
#0 1.354 
#0 1.354 Warning: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
#0 1.354 error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in PEAR/Proxy.php on line 183
#0 1.355 
#0 1.355 Warning: fsockopen(): Failed to enable crypto in PEAR/Proxy.php on line 183
#0 1.357 
#0 1.357 Warning: fsockopen(): unable to connect to ssl://pecl.php.net:443 (Unknown error) in PEAR/Proxy.php on line 183
#0 1.359 No releases available for package "pecl.php.net/imagick"
#0 1.360 Cannot initialize 'channel://pecl.php.net/imagick-beta', invalid or missing package file
#0 1.362 Package "channel://pecl.php.net/imagick-beta" is not valid
#0 1.366 install failed
------
failed to solve: process "/bin/sh -c yes '' | pecl -vvv install imagick-beta" did not complete successfully: exit code: 1

The only recent post I found about someone having the same issue is this bug report but I’m not sure about the channel where I’d see any updates on fixing this bug. In the bug report the last person states the following:

Certificate expiry is set to yesterday. I’m thinking about all docker build pipelines currently failing all over the world <3

Does he mean about php.net‘s SSL certificate? Because when I checked it it looks valid so I don’t understand why it can not connect.

line 183 of PEAR/proxy.php is the following:

$fp = @fsockopen($host, $port, $errno, $errstr);

So if I understand correctly, the docker container can not establish a proper connection via pecl.php.net:443? Has anyone encountered the same issue?

Thanks in advance for any (constructive) answers!

2

Answers


  1. As I see it indicates that the SSL certificate verification failed, to fix it you can try disabling SSL certificate verification in the Dockerfile by adding this line before the pecl install command!

    RUN pecl config-set "disable-tls" "yes"
    

    or you can also updating the SSL certificate for pecl.php.net

    good luck!

    Login or Signup to reply.
  2. I was able to get around this problem by installing the packages directly from the project’s git repository.

    FROM php:7.0-alpine
    
    RUN apk update && apk add --no-cache imagemagick-dev libtool make g++
    
    RUN wget https://github.com/ImageMagick/ImageMagick6/archive/refs/tags/6.9.12-28.tar.gz && 
         tar -xzf 6.9.12-28.tar.gz && 
         cd ImageMagick6-6.9.12-28 && 
         ./configure && 
         make && 
         make install
    
    RUN wget https://pecl.php.net/get/imagick-3.4.4.tgz && 
         tar -xzf imagick-3.4.4.tgz && 
         cd imagick-3.4.4 && 
         phpize && 
         ./configure --with-imagick=/usr/local && 
         make && 
         make install
    
    RUN echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search