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
编译安装apache方法二:
yum -y install expat-devel
yum -y install pcre-devel
下载apr和apr-util包,将解压的库文件夹移动到httpd子目录的srclib目录里(去掉版本号):
cp -rf apr-1.5.2 /root/httpd-2.4.18/srclib/apr //将版本号去掉,下同
cp -rf apr-util-1.5.4 /root/httpd-2.4.18/srclib/apr-util
./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-mpm=event --with-included-apr --with-ssl=/usr/local/openssl --with-nghttp2 --enable-modules=reallyall --enable-mods-shared=reallyall
http://apr.apache.org/download.cgi #apr和apr-util包下载
https://www.cnblogs.com/llius/p/5110628.html
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
[root@test ~]# php -i|grep configure #查看php编译参数
测试文件:getimagesize.php checkCode.php
[root@test ~]# cat /usr/local/apache/build/config.nice #查看apache编译参数
[root@test ~]# httpd -V (/usr/local/httpd/bin/apachectl -V) #查看apache配置文件路径
参考链接:
https://blog.51cto.com/castiel/2051440 #源码编译apache报错的解决方法
https://www.cnblogs.com/wenzheshen/p/11179533.html #php访问ssl证书报错
https://blog.csdn.net/enlangs/article/details/78988673 #php访问ssl证书报错