本文基于《 五分钟利用docker搭建好php7.0.10+nginx服务环境》
对PHP进行扩展升级!
将以下代码保存为一份xxx.sh 并执行,即可扩展mysql、gd、phalcon
#! /usr/bin PHP_VERSION=7.0.10 docker run --name php \ -v /home/wwwroot:/home/wwwroot \ -v ~/php_config/php.ini:/usr/local/etc/php/php.ini \ -p 9000:9000 \ -d php:{PHP_VERSION}-fpm docker exec -it php sed -i "s/33/2016/g" /etc/passwd docker exec -it php sed -i "s/33/2016/g" /etc/group docker exec -it php bash -c "set -ex \ && cd ~ \ && mv /etc/apt/sources.list /etc/apt/sources.list.bak \ && { \ echo deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib; \ echo deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib; \ echo deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib; \ echo deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib; \ } | tee /etc/apt/sources.list \ && apt-get update \ && apt-get install -y git \ libpcre3-dev \ libfreetype6-dev \ libjpeg62-turbo-dev \ libmcrypt-dev \ libpng12-dev \ && docker-php-ext-install -j(nproc) iconv mcrypt \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j(nproc) gd \ && docker-php-ext-install mysql \ && docker-php-ext-install pdo_mysql \ && curl -o /usr/local/etc/php/php.ini https://raw.githubusercontent.com/php/php-src/PHP-{PHP_VERSION}/php.ini-production \ && git clone -b 2.1.x --depth=1 git://github.com/phalcon/cphalcon.git ~/cphalcon \ && cd ~/cphalcon/ext \ && export CFLAGS=\"-O2 -finline-functions -fvisibility=hidden\" \ && phpize \ && ./configure --enable-phalcon \ && make \ && make install \ && docker-php-ext-enable phalcon \ && rm -rf ~/cphalcon" docker commit -a "technofiend <[email protected]>" -m "install gd、 phalcon、pdo_mysql、mysql extsions" php phalcon:{PHP_VERSION}-fpm docker rm -f php docker run --name php \ -v /home/wwwroot:/home/wwwroot \ -v ~/php_config/php.ini:/usr/local/etc/php/php.ini \ -p 9000:9000 \ -d phalcon:{PHP_VERSION}-fpm docker exec -it php sed -i "s/33/2016/g" /etc/passwd docker exec -it php sed -i "s/33/2016/g" /etc/group