微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CentOS610 php环境安装

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报错的解决方法

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐