构建编译环境
进入源码目录
./configure \
--prefix=/usr/local/php8 \
--enable-fpm \
--enable-gd \
--with-pdo-mysql \
--with-curl \
--with-fpm-user=ubuntu \
--with-fpm-group=ubuntu \
--with-zlib \
--with-jpeg \
--with-webp=/usr/local/include/webp \
--with-freetype=/usr/local/freetype \
--without-sqlite3 \
--without-pdo-sqlite \
--disable-rpath\
编译安装
make && make install
拷贝配置文件
cp /home/php/php.ini-development /usr/local/php8/lib/php.ini
cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf
重启php-fpm
killall php-fpm && /usr/local/php8/sbin/php-fpm
安装redis扩展
phpize
./configure
make && make install
安装openssl扩展
phpize
./configure --with-openssl --with-php-config=/usr/local/php8/bin/php-config
make && make install
安装jpeg
centos7 下对 php7.2.9 安装 jpeg 扩展_huaminghui的博客-优快云博客
make clean
./configure --prefix=/usr/local/jpeg
make && make install
安装gd库
./configure --with-php-config=/usr/local/php8/bin/php-config --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype
make && make install
#提示找不到freetype2,echo PKG_CONFIG_PATH;
export PKG_CONFIG_PATH=/usr/local/freetype/lib/pkgconfig
然后再重新配置
其他
安装扩展后记得在php.ini中添加
freetype下载地址
https://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.gz
jpeg下载地址
Independent JPEG Group
phpize的作用
用来扩展php的扩展模块,通过phpize可以建立php的外挂模块
主要作用就是检测环境以及在特定的目录生成相应的configure文件,这样make install命令后,生成的.so文件会自动加载到php扩展目录下面。
未解决的问题:
今天gd模块一直不出现jpeg,导致操作imagecreatefromjpeg 函数一直报错。一直在找原因,找到在发吧
欢迎关注微信公众号:php全栈技术