1:进入docker容器
docke exec -it php bash
2:安装mysql_pdo扩展
docker-php-ext-install pdo pdo_mysql
3:安装GD库
apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
docker-php-ext-install gd
4:修改php.ini配置
vi /usr/local/etc/php/php.ini
#添加
extension=pdo_mysql.so
extension=gd.so
5:重启docker
docker restart php
6:进入docke查看是否安装成功
root@b4587d511057:/var/www/html# php -m
[PHP Modules]
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mhash
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
安装过程源出错WARNING: The following packages cannot be authenticated!
rm -frv /var/lib/apt/lists
mkdir -pv /var/lib/lists/partial
apt-get update