php56安装并开启mysql

This commit is contained in:
许 洋 2024-11-22 11:25:11 +08:00
parent 0ab8e2a9a8
commit 9ee005bffb
3 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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