Nghttp2编译安装
nghttp2-1.24.0.tar.bz2
./configure --prefix=/usr/local/nghttp2 && make && make install
ln -sv /usr/local/nghttp2/lib/libnghttp2.so.14 /usr/lib/libnghttp2.so.14 && ldconfig
apr编译安装
apr-1.6.3.tar.gz
yum -y install expat-devel
./configure --prefix=/usr/local/apr && make && make install
apr-util编译安装
apr-util-1.6.1.tar.gz
yum -y install libxml2-devel
cd /root/apr-util-1.6.1 #进入解压目录
make clean #编译过需要清除make缓存
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
apache依赖
yum -y install pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl-devel
编译安装apache
wget http://archive.apache.org/dist/httpd/httpd-2.4.37.tar.gz
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-ssl --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support && make && make install
php依赖
yum -y install curl-devel
yum -y install libpng libpng-devel
yum -y install libjpeg-devel
yum -y install freetype-devel
jpeg编译安装
jpegsrc.v8b.tar.gz
wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make && make install
编译安装php
wget --no-check-certificate https://www.php.net/distributions/php-7.2.12.tar.gz
cd root/php-7.2.12
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-mbstring --with-openssl --with-curl --enable-fpm --enable-mysqlnd --with-pdo-mysql=mysqlnd --with-config-file-path=/usr/local/php/etc/ --with-mysqli=mysqlnd --enable-pcntl --with-fpm-user=nobody --with-fpm-group=nobody --disable-fileinfo
make && make install
php编译完成后安装(可不安装)
wget --no-check-certificate http://pear.php.net/go-pear.phar
/usr/local/php/bin/php go-pear.phar
编译安装gd库
cd /root/php-7.2.12/ext/gd
/usr/local/php/bin/phpize #运行php安装目录下的phpize文件,这时候会在gd库目录下生成相应的configure文件,如有configure文件请忽略
./configure --with-php-config=/usr/local/php/bin/php-config --with-png-dir --with-freetype-dir --with-jpeg-dir=/usr/local/jpeg --with-zlib-dir --with-gd
make && make install
ls /usr/local/php/lib/php/extensions/no-debug-zts-20170718/
gd.so opcache.so
php.ini配置文件dg选项中添加gd.so文件路径
php.ini
cd /usr/local/php/etc #php配置文件目录,编译安装没有php.ini文件
[gd]
; Tell the jpeg decode to ignore warnings and try to create
; a gd image. The warning will then be displayed as notices
; disabled by default
; http://php.net/gd.jpeg-ignore-warning
;gd.jpeg_ignore_warning = 0
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20170718/gd.so
php查看编译参数
[root@test ~]# php -i|grep configure
测试文件:getimagesize.php checkCode.php
参考链接:
https://blog.51cto.com/castiel/2051440 #源码编译apache报错的解决方法