DockerFile
FROM harbor.ym/php-fpm/php56fpm
RUN apk add make gcc libc-dev libcurl curl-dev libpng libpng-dev openldap-dev postgresql-dev autoconf && \
cd /tmp && \
wget "https://www.php.net/distributions/php-5.6.40.tar.gz" && \
tar -xzvf php-5.6.40.tar.gz && cd php-5.6.40 && \
./configure --prefix=/usr/local/php5.6.40/ \
--with-config-file-path=/usr/local/php5.6.40/etc/ --with-config-file-scan-dir=/usr/local/php5.6.40/etc/conf/ \
--enable-bcmath --with-curl --enable-exif --with-gd --with-ldap --enable-mbstring --with-mysql --with-mysqli --enable-pcntl --enable-opcache --with-pdo-mysql \
--with-pdo-pgsql --without-pdo-sqlite --with-pgsql --enable-phpdbg --enable-maintainer-zts &&\
make && make install &&\
cp php.ini-production /usr/local/php5.6.40/etc/php.ini && \
#add redis
wget "https://pecl.php.net/get/redis-4.3.0.tgz" && tar -xzvf redis-4.3.0.tgz && cd redis-4.3.0 && /usr/local/php5.6.40/bin/phpize &&\
./configure --with-php-config=/usr/local/php5.6.40/bin/php-config && make && make install && \
mkdir /usr/local/php5.6.40/etc/conf &&\
echo extension=redis.so >> /usr/local/php5.6.40/etc/conf/redis.ini &&\
wget https://pecl.php.net/get/pthreads-2.0.10.tgz && tar -xzvf pthreads-2.0.10.tgz && cd pthreads-2.0.10 && /usr/local/php5.6.40/bin/phpize &&\
./configure --with-php-config=/usr/local/php5.6.40/bin/php-config && make && make install && \
echo extension=pthreads.so >> /usr/local/php5.6.40/etc/conf/redis.ini &&\
rm -rf /tmp/* && \
apk del make gcc libc-dev libcurl curl-dev libpng libpng-dev openldap-dev postgresql-dev autoconf && \
apk cache --purge
安装通用依赖:
-dev和-devel 后缀的包是一样的,比如libxml2-devel ,如果apk add libxml2-devel 找不到,则可以用libxml2-dev ,一般来说如果缺少xx包,一般需要按照xx-dev/devel的包依赖。
有dev/devel后缀的是指开发包,包括配置,否则只有库包。如果是编译安装,则需要安装dev/devel后缀的依赖包。比如:需要 sqlite-dev-3.35.5-r0,而不是sqlite-3.35.5-r0(这个装了还是会提示没有依赖包)
apk add make gcc libc-dev libcurl curl-dev libpng libpng-dev openldap-dev postgresql-dev autoconf libxml2-dev freetype-dev oniguruma-dev gettext-dev sqlite-dev libjpeg-turbo-dev
./configure 后如果发现少了依赖比如:libjpeg
apk search libjpeg
暗夜之中,才见繁星;危机之下,暗藏转机;事在人为,为者常成。