错误提示:
If configure fails try --with-webp-dir=<DIR>
If configure fails try --with-jpeg-dir=<DIR>
configure: error: png.h not found.
解决方法:
apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
docker-php-ext-configure gd \
--with-gd \
--with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
docker-php-ext-install -j${NPROC} gd && \
apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev
安装gettext报错
checking for GNU gettext support... yes, shared
configure: error: Cannot locate header file libintl.h
先安装
apk add --no-cache gettext-dev
...
Executing busybox-1.28.4-r3.trigger
OK: 229 MiB in 70 packages
然后再安装:
/var/www/html # /usr/local/bin/docker-php-ext-install gettext
安装memcached扩展
apk add --update \
autoconf \
file \
g++ \
gcc \
libc-dev \
make \
pkgconf \
re2c \
zlib-dev \
libmemcached-dev && \
cd /tmp && \
wget https://github.com/php-memcached-dev/php-memcached/archive/php7.zip && \
unzip php7.zip && \
cd php-memcached-php7 && \
phpize || return 1 && \
./configure --prefix=/usr --disable-memcached-sasl --with-php-config=php-config || return 1 && \
make || return 1 && \
make INSTALL_ROOT="" install || return 1 && \
install -d "/etc/php7/conf.d" || return 1 && \
echo "extension=memcached.so" > /etc/php7/conf.d/20_memcached.ini && \
cd /tmp && rm -rf php-memcached-php7 && rm php7.zip
安装php-redis
cd /tmp \
&& wget https://github.com/igbinary/igbinary/archive/2.0.4.zip \
&& unzip 2.0.4.zip && cd igbinary-2.0.4 \
&& phpize && ./configure --with-php-config=php-config \
&& make && make install \
&& echo extension=igbinary.so >> /etc/php7/conf.d/01_igbinary.ini
wget https://github.com/phpredis/phpredis/archive/3.1.2.zip \
&& unzip 3.1.2.zip && cd phpredis-3.1.2 \
&& phpize && ./configure --enable-redis-igbinary --with-php-config=php-config \
&& make && make install \
&& echo extension=redis.so >> /etc/php7/conf.d/01_redis.ini
安装完之后运行
docker-php-ext-enable igbinary
docker-php-ext-enable redis
重启容器,访问phpinfo页面