手动编译php7.2,php7.2 编译安装

安装前的准备:

下载安装包:

wget http://sg2.php.net/distributions/php-7.2.6.tar.gz

解压:

tar zxf php-7.2.6.tar.gz

安装依赖包构建编译环境:

yum install gcc libxml2 libxml2-devel openssl openssl-devel curl

安装(将安装的软件进行配置,检查当前的环境是否满足要安装软件的依赖关系)

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl --with-gettext --enable-zip --enable-soap --disable-debug

注释:

--enable-fpm

--prefix=/usr/local/php //指定 php 安装目录

--with-apxs2=/usr/local/apache/bin/apxs //整合apache,apxs功能是使用mod_so中的LoadModule指令,加载指定模块到 apache,要求 apache 要打开SO模块

--with-config-file-path=/usr/local/php/etc //指定php.ini位置

--with-MySQL=/usr/local/mysql //mysql安装目录,对mysql的支持

--with-mysqli=/usr/local/mysql/bin/mysql_config //mysqli扩展技术不仅可以调用MySQL的存储过程、处理MySQL事务,而且还可以使访问数据库工作变得更加稳定。

--with-pdo-mysql=mysqlnd

--enable-ftp //打开ftp的支持

--enable-zip //打开对zip的支持

--with-bz2 //打开对bz2文件的支持,bzip2 函数用于透明地读写 bzip2(.bz2)压缩文件。

--with-jpeg-dir //打开对jpeg图片的支持

--with-png-dir //打开对png图片的支持

--with-freetype-dir //打开对freetype字体库的支持

--with-libXML-dir //打开libxml2库的支持

--with-XMLrpc //打开xml-rpc的c语言

--with-zlib-dir //打开zlib库的支持

--with-gd //打开gd库的支持

--enable-gd-native-ttf //支持TrueType字符串函数库

--with-curl //打开curl浏览工具的支持

--with-curlwrappers //运用curl工具打开url流

--with-ttf //打开freetype1.*的支持,可以不加了

--with-xsl //打开XSLT 文件支持,扩展了libXML2库 ,需要libxslt软件

--with-gettext //打开gnu 的gettext 支持,编码库用到

--with-pear //打开pear命令的支持,PHP扩展用的

--enable-calendar //打开日历扩展功能

--enable-mbstring //多字节,字符串的支持

--enable-bcmath //打开图片大小调整,用到zabbix监控的时候用到了这个模块

--enable-sockets //打开 sockets 支持--enable-exif,图片的元数据支持

--enable-magic-quotes //魔术引用的支持

--disable-rpath //关闭额外的运行库文件

--disable-debug //关闭调试模式

--with-mime-magic=/usr/share/file/magic.mime //魔术头文件位置

成功会输出: Thank you for using PHP.等字样

编译

make

安装

make install

配置

cp php.ini-development /usr/local/php/php.ini

cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf

cp sapi/fpm/php-fpm /usr/local/bin

配置php.ini (修改php.ini需要重启 php-fpm)

配置php-fpm

配置nginx

location ~ \.php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

可以参照官方文档:http://php.net/manual/zh/install.unix.nginx.php,该文章是作者根据自己实际的操作编写的,如有错误,欢迎指出。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值