Docker PHP 安装扩展汇总

Docker PHP 安装扩展汇总,第1张

FROM php:7.2-fpm

Core, ctype, curl

date, dom

fileinfo, filter, ftp

hash

iconv

json

libxml

mbstring, mysqlnd

openssl

pcre, PDO, pdo_sqlite, Phar, posix

readline, Reflection, session, SimpleXML, sodium, SPL, sqlite3, standard

tokenizer

xml, xmlreader, xmlwriter

zlib

RUN docker-php-ext-install -j$(nproc) bcmath calendar exif gettext

sockets dba mysqli pcntl pdo_mysql shmop sysvmsg sysvsem sysvshm

RUN apt-get update &&

apt-get install -y --no-install-recommends libbz2-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) bz2

RUN apt-get update &&

apt-get install -y --no-install-recommends libenchant-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) enchant

RUN apt-get update &&

apt-get install -y --no-install-recommends libfreetype6-dev libjpeg62-turbo-dev libpng-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ &&

docker-php-ext-install -j$(nproc) gd

RUN apt-get update &&

apt-get install -y --no-install-recommends libgmp-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) gmp

RUN apt-get update &&

apt-get install -y --no-install-recommends libxml2-dev libtidy-dev libxslt1-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) soap wddx xmlrpc tidy xsl

RUN apt-get update &&

apt-get install -y --no-install-recommends libzip-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) zip

RUN apt-get update &&

apt-get install -y --no-install-recommends libsnmp-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) snmp

RUN apt-get update &&

apt-get install -y --no-install-recommends libpq-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) pgsql pdo_pgsql

RUN apt-get update &&

apt-get install -y --no-install-recommends libpspell-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) pspell

RUN apt-get update &&

apt-get install -y --no-install-recommends librecode-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) recode

RUN apt-get update &&

apt-get install -y --no-install-recommends firebird-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) pdo_firebird

RUN apt-get update &&

apt-get install -y --no-install-recommends freetds-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-configure pdo_dblib --with-libdir=lib/x86_64-linux-gnu &&

docker-php-ext-install -j$(nproc) pdo_dblib

RUN apt-get update &&

apt-get install -y --no-install-recommends libldap2-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu &&

docker-php-ext-install -j$(nproc) ldap

RUN apt-get update &&

apt-get install -y --no-install-recommends libc-client-dev libkrb5-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-configure imap --with-kerberos --with-imap-ssl &&

docker-php-ext-install -j$(nproc) imap

RUN apt-get update &&

apt-get install -y --no-install-recommends firebird-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) interbase

RUN apt-get update &&

apt-get install -y --no-install-recommends libicu-dev &&

rm -r /var/lib/apt/lists/* &&

docker-php-ext-install -j$(nproc) intl

RUN apt-get update &&\

apt-get install -y --no-install-recommends libmcrypt-dev &&

rm -r /var/lib/apt/lists/* &&

pecl install mcrypt-1.0.1 &&

docker-php-ext-enable mcrypt

RUN export CFLAGS=" PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" &&

apt-get update &&

apt-get install -y --no-install-recommends libmagickwand-dev &&

rm -rf /var/lib/apt/lists/* &&

pecl install imagick-3.4.3 &&

docker-php-ext-enable imagick

RUN apt-get update &&\

apt-get install -y --no-install-recommends zlib1g-dev libmemcached-dev &&

rm -r /var/lib/apt/lists/* &&

pecl install memcached &&

docker-php-ext-enable memcached

RUN pecl install redis-4.0.1 &&docker-php-ext-enable redis

RUN docker-php-ext-configure opcache --enable-opcache &&docker-php-ext-install opcache

RUN set -ex

docker-php-source extract

{

echo '# https://github.com/docker-library/php/issues/103#issuecomment-271413933'

echo 'AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl'

echo

cat /usr/src/php/ext/odbc/config.m4

} >temp.m4

mv temp.m4 /usr/src/php/ext/odbc/config.m4

apt-get update

apt-get install -y --no-install-recommends unixodbc-dev

rm -rf /var/lib/apt/lists/*

docker-php-ext-configure odbc --with-unixODBC=shared,/usr

docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr

docker-php-ext-install odbc pdo_odbc

docker-php-source delete

LABEL Author="Leo"

LABEL Version="1.0.25-fpm"

LABEL Description="PHP FPM 7.2 镜像. All extensions."

镜像中没有make命令,甚至没有gcc、g++,虽然有pecl,但是由于没有gcc编译器,所以也不能运行phpize其实在该镜像的/usr/local/bin目录下有一个docker-php-ext-install程序专门用来安装php扩展运行它即可显示出能够安装的扩展,配合docker-php-ext-enable程序可以控制扩展的启动/禁用。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11443349.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存