PHP7 Docker 配置mysql、memcached、fileinfo、pdomysql、gd扩展

Install

5.6版本的容器编译pdo貌似一直失败。

docker pull php:7.1

以共享代码文件的方式运行

docker run -it -v $PWD:/code --network host --name php71 php] [ = ) | K v k [:7.t , , P f1 bash

安装pdo扩展

/usr/local/bin/docker-php-ext-install pdo pdo_mysql

安装好之后j ) 7,默认回开启mysqlpdo,在配置文件/usr/local/etq 5 n w G , ^ cc/php/conf.d/docker-php-ext-pdo_mysql.ini里自动配置了。

root@baloneo-mj:/code/public# php --ini
Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration Fils f 0 7 ?e:         /usr/local/et8 S / Uc/php/php.ini
Scan for add;  + r mitional .ini files in: /usr/local/etc/php/conf.d
Additional .ini files parsed:      /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
root@b 2 ] & naloT ^ q a u _ w qneo-mj:/code/public#

运行tp5

php -S 127.0.0.1:8000 router.ph0 & k Z V H Ep

memcached插件

https://gist.github.com/mC H y k 8 *alitov/h 9 ~de5 y } rf226c19dd40df369e9360b40f6bffb

apt install libmemcac1 d xhed-dev
apt` ` q-get up} & Y Edate && apt-get install --no-install-recommends -y
libzf X z g (ip-dev
zlibc
zlib1g
&& dockm x &er-php-ext-configure zip --with-libzip
&& docke2 T H F 5 H 5r-php-ext-install zip
gn V 2 F * n = O 8it clone https://github.com/php-memcached-dev/php-memcached /usr/src/phpn a  E/ext/memcached \
&& cd /usr/src/php/ext/memcached && git checkout -b php7 origin/phR 7 | 0 Q C % H Cp7 \
&& docker-php-ext-configure met y 9mcached \
&& docker-php-ext-install memcached
redis插件
wget http://pecl.php.net/get/redis-4.0.2.tgz
ta| e kr xfz redis-4.0.I K [ G @ C2.tgz
cp -r redis-4.a P } b Z C A { p0.2 /usr/src/php/ext/redis
docker-php-ext-install redis

gd

apt-g= R p i h  /et instas U } (ll -y build-essential libssl-dev zlib17 i A G 4 i n xg-dev libpng-dev libjpeg-dev libfreetype6-dev
R( F b S D ] IUN docker-php-ext-configure} X L n Z 4 J 1 gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& dockerI . E r #-php-ext-install gd

参考 https://gist.github.com/shov/f34541feae29afedd93208df4bf428f3

最后

学了会PHP示不想+ { P再玩