From 9ee005bffbc14e58c9b2c1ad4d03f09dfb40e2fe Mon Sep 17 00:00:00 2001 From: xuyang Date: Fri, 22 Nov 2024 11:25:11 +0800 Subject: [PATCH] =?UTF-8?q?php56=E5=AE=89=E8=A3=85=E5=B9=B6=E5=BC=80?= =?UTF-8?q?=E5=90=AFmysql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/php56/Dockerfile | 7 ++++++- services/php56/docker-php-ext-enable | 8 ++++++++ services/php70/Dockerfile | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 services/php56/docker-php-ext-enable diff --git a/services/php56/Dockerfile b/services/php56/Dockerfile index 9e81ee4..e5aaa71 100644 --- a/services/php56/Dockerfile +++ b/services/php56/Dockerfile @@ -2,7 +2,7 @@ ARG PHP_VERSION=php:5.6.36-fpm-alpine3.4 FROM ${PHP_VERSION} ARG TZ=Asia/Shanghai -ARG PHP_EXTENSIONS=pdo_mysql,mysqli,mbstring,gd,curl,opcache,yaf,bcmath,mbstring,gettext,yaml,mongo,rar,redis,phalcon +ARG PHP_EXTENSIONS=pdo_mysql,mysqli,mbstring,gd,curl,opcache,yaf,bcmath,mbstring,gettext,yaml,mongo,rar,redis,phalcon,mysql ARG CONTAINER_PACKAGE_URL=mirrors.163.com @@ -20,6 +20,11 @@ RUN apt-get install tzdata \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && echo "$TZ" > /etc/timezone +COPY ./docker-php-ext-enable /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-php-ext-enable + +RUN docker-php-ext-install mysql +RUN docker-php-ext-enable mysql # Debian/Ubuntu 上有内置的iconv,不需要这个了 # Fix: https://github.com/docker-library/php/issues/240 diff --git a/services/php56/docker-php-ext-enable b/services/php56/docker-php-ext-enable new file mode 100644 index 0000000..2f977c0 --- /dev/null +++ b/services/php56/docker-php-ext-enable @@ -0,0 +1,8 @@ +#!/bin/bash + +ext=$1 +line="extension=$ext.so" +ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" +if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" +fi \ No newline at end of file diff --git a/services/php70/Dockerfile b/services/php70/Dockerfile index 779e5c4..e6f4504 100644 --- a/services/php70/Dockerfile +++ b/services/php70/Dockerfile @@ -24,7 +24,7 @@ RUN apk add --no-cache openssl && apk --no-cache add libzip-dev \ RUN apk update && apk --no-cache add shadow # php image's www-data user uid & gid are 82, change them to 1000 (primary user) -RUN usermod -u 1000 www-data && groupmod -g 1000 www-data +# RUN usermod -u 1000 www-data && groupmod -g 1000 www-data # Use www-data to run the first process USER www-data