docker-library / php

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

php5.6-apache and mysql driver #579

Closed tuananh closed 6 years ago

tuananh commented 6 years ago

Not a PHP guy so please bear with me here.

FROM php:5.6.33-apache-jessie
RUN docker-php-ext-install -j$(nproc) pdo_mysql mysql mysqli

And i got this error

POSIX.pm did not return a true value at /usr/share/perl5/Dpkg/Arch.pm line 33.
BEGIN failed--compilation aborted at /usr/share/perl5/Dpkg/Arch.pm line 33.
Compilation failed in require at /usr/bin/dpkg-architecture line 33.
BEGIN failed--compilation aborted at /usr/bin/dpkg-architecture line 33.
The command '/bin/sh -c docker-php-ext-install -j$(nproc) pdo_mysql mysql mysqli' returned a non-zero code: 255

Can someone check to see what I did wrong here?

tuananh commented 6 years ago

Test with 7.0 image

my dockerfile

FROM php:7.0-apache
RUN docker-php-ext-install pdo_mysql
COPY src/ /var/www/html/

output

Sending build context to Docker daemon  4.608kB
Step 1/3 : FROM php:7.0-apache
 ---> c7db7ef72210
Step 2/3 : RUN docker-php-ext-install pdo_mysql
 ---> Running in df344d3ad9f9
POSIX.pm did not return a true value at /usr/share/perl5/Dpkg/Arch.pm line 33.
BEGIN failed--compilation aborted at /usr/share/perl5/Dpkg/Arch.pm line 33.
Compilation failed in require at /usr/bin/dpkg-architecture line 33.
BEGIN failed--compilation aborted at /usr/bin/dpkg-architecture line 33.
The command '/bin/sh -c docker-php-ext-install pdo_mysql' returned a non-zero code: 255
yosifkit commented 6 years ago

I am unable to reproduce. Try deleting the image and then pulling it new.

tuananh commented 6 years ago

Thanks. I tried pulling again and it works On Sat, 3 Feb 2018 at 01:51, yosifkit notifications@github.com wrote:

I am unable to reproduce. Try deleting the image and then pulling it new.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/docker-library/php/issues/579#issuecomment-362668601, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmSTrfoj0rsCQOZggYsMCiXtmlTvujZks5tQ1YTgaJpZM4R26I7 .

Drugoy commented 6 years ago

In case of Alpine:

FROM php:5-fpm-alpine
RUN apk add --no-cache git bash tini memcached php5-pcntl php5-common php5-openssl php5-json php5-phar php5-zlib php5-xml php5-curl php5-dom php5-pdo php5-memcache php5-mysql php5-pdo_mysql \
        && docker-php-ext-install pcntl pdo_mysql mysql json \
        && docker-php-ext-enable pcntl pdo_mysql mysql json

This is not minimal, but still it's at least some working Dockerfile for building a container of php-fpm with mysql extension based on Alpine (3.4). Maybe this will save some time for someone.