Docker安装mysqli扩展
官方php镜像
- docker exec -it php-fpm bash
- cd /usr/local/bin
- ./docker-php-ext-install mysqli
Docker安装gd扩展
- docker exec -it php-fpm bash
- echo "deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free" > /etc/apt/sources.list #软件源修改为科大源(别的源也可以,但容易被坑,如果后面出问题,这里不要改源再试一下,但就是慢)
- apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev #安装各种库
- docker-php-source extract #解压源码
- cd /usr/src/php/ext/gd #gd源码文件夹
- docker-php-ext-configure gd --with-webp-dir=/usr/include/webp --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-freetype-dir=/usr/include/freetype2 #准备编译
- docker-php-ext-install gd #编译安装
- php -m | grep gd #看看装上没
- docker restart php-fpm
php-fpm是php容器的名字