php-7.2.8 fpm compile
配置
./configure \
--prefix=/usr/local/services/php-7.2.8 \
--with-libxml-dir=/usr/local/services/libxml2 \
--with-openssl=/usr/local/services/openssl \
--with-pdo-mysql \
--enable-mbstring \
--enable-sockets \
--enable-pcntl \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-soap \
--enable-shmop \
--enable-bcmath \
--enable-zip \
--enable-calendar \
--enable-ctype \
--enable-dom \
--enable-filter \
--enable-hash \
--enable-json \
--enable-posix \
--enable-shared \
--enable-simplexml \
--enable-static \
--enable-tokenizer \
--enable-xml \
--enable-xmlwriter \
--enable-pdo \
--enable-fpm \
--enable-mysqlnd
编译
make -j 2
安装
make install
待选项 todo
--enable-inline-optimization
--enable-maintainer-zts
--enable-gd-native-ttf
--with-gd=/usr/local/services/libgd
--with-freetype-dir=/usr/local/services/freetype
--with-png-dir=/usr/local/services/libpng
--with-jpeg-dir=/usr/local/services/jpeg
以扩展的方式编译 gd 库
gd 依赖 libpng、jpegsrc、freetype 库
注意这种安装方式和 php builtin 编译有些不同
builtin 方式,需要先将 gd 的库编译完成,之后才能编译 php
扩展的方式,直接进入 php-src/ext/gd 编译即可,不需要单独编译(为什么?)
安装图片依赖
brew install zlib jpeg libpng libjpeg freetype
编译扩展
cd /data/src/php-7.2.8/ext/gd
phpize
./configure --with-php-config=/usr/local/services/php7/bin/php-config \
--with-freetype-dir=/usr/local/Cellar/freetype/2.9.1 \
--with-jpeg-dir=/usr/local/Cellar/jpeg/9c \
--with-png-dir=/usr/local/Cellar/libpng/1.6.35
make
cp modules/gd.so /usr/local/services/php7/extensions/
修改配置
php.ini 加载 gd.so
启动 php-fpm
配置
cd /usr/local/services/php/etc
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf
启动
sudo /usr/local/services/php/sbin/php-fpm