1.安装依赖软件库:

yum install -y libxml2-devel libtool* curl-devel libjpeg-devel libpng-devel freetype-devel

2.下载php7源码包进行编译安装

[root@iZ2zef0e6br88incakir9rZ opt]# wget http://cn2.php.net/distributions/php-7.0.14.tar.gz

[root@iZ2zef0e6br88incakir9rZ opt]# tar xf php-7.0.14.tar.gz

[root@iZ2zef0e6br88incakir9rZ opt]# cd  php-7.0.14
   [root@iZ2zef0e6br88incakir9rZ opt]#  ./configure --prefix=/usr/local/php-7.0.14 --enable-fpm --enable-opcache --with-config-file-path=/usr/local/php-7.0.14/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-static --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-soap --with-zlib --with-iconv --with-freetype-dir --with-gd --with-jpeg-dir --with-xmlrpc --enable-mbstring --with-sqlite3 --with-curl --enable-ftp --with-mcrypt --with-openssl --disable-safe-mode --with-gettext

报错:configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决:下载libmcrypt源码库

wget https://svwh.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

编译安装:
make && make install

3.配置文件php.ini

[PHP]
engine = On #是否启用php解析引擎
short_open_tag = On #是否使用简介标志
precision = 14 #浮点数中显示有效数字的位数
output_buffering = 4096 #输出缓冲区的大小
zlib.output_compression = Off #是否开启zlib输出压缩
implicit_flush = Off #unserialize_callback_func = #serialize_precision = 17 disable_functions = #disable_classes = #zend.enable_gc = On #激活循环引用收集器。
expose_php = On #max_execution_time = 300 #程序执行最大时间,默认为30s,0表示没有时间限制,这里设置300s,可以自定义设置
max_input_time = 300 memory_limit = 128M error_reporting = E_ALL display_errors = Off display_startup_errors = On php有错误出理,就会提示,而且在事件查看器中有记录。如果设置为display_startup_errors = Off,则不会有任何提示
log_errors = On log_errors_max_len = 1024 error_log=/data/log/php/error_php7.log 设置错误日志文件保存路径
ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On track_errors = On html_errors = On variables_order = "GPCS" 此指令描述了PHP注册GET, POST, Cookie, 环境 和 内置变量的顺序 (各自使用G, P, C, E 和 S , 一般使用 EGPCS 或 GPC). 注册使用从左往右的顺序, 新的值会覆盖旧的值
request_order = "GP" register_argc_argv = Off auto_globals_jit = On post_max_size = 16M auto_prepend_file = auto_append_file = default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root = user_dir = enable_dl = Off file_uploads = On upload_max_filesize = 2M max_file_uploads = 20 allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 cgi.fix_pathinfo= 1
[CLI Server]
cli_server.color = On
[Date]
date.timezone = Asia/Shanghai 设置区域时间
[Pdo_mysql]
pdo_mysql.cache_size = 2000 pdo_mysql.default_socket= 默认的socket时间
[Phar]
[mail function] 邮件功能
SMTP = localhost smtp_port = 25 mail.add_x_header = On 是否开启最大的header
[SQL]
sql.safe_mode = Off 对于每个不同数据库的连接函数,其默认值请参考相应的手册页面。
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQLi]
mysqli.max_persistent = -1 mysqli.allow_persistent = On mysqli.max_links = -1 mysqli.cache_size = 2000 mysqli.default_port = 3306 mysqli.default_socket = mysqli.default_host = mysqli.default_user = mysqli.default_pw = mysqli.reconnect = Off [mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = On
[PostgreSQL]
pgsql.allow_persistent = On pgsql.auto_reset_persistent = Off pgsql.max_persistent = -1 pgsql.max_links = -1 pgsql.ignore_notice = 0 pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[Session]
session.save_handler = files session.use_strict_mode = 0
session.use_cookies = 1 session.use_only_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = cookie的有效域名
session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[Assertion]
zend.assertions = 1
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
 
4.进程服务的配置文件php-fpm,把php-fpm引入www.conf文件中的配置

[root@iZ2zef0e6br88incakir9rZ etc]# cat /usr/local/php-7.0.14/etc/php-fpm.conf
include=/usr/local/php-7.0.14/etc/php-fpm.d/*.conf
[root@iZ2zef0e6br88incakir9rZ etc]# vim /usr/local/php-7.0.14/etc/php-fpm.d/www.conf
[global] 全局定义
log_level = notice 错误级别. 可用级别为: alert(必须立即处理), error(错误情况), warning(警告情况), notice(一般重要信息), debug(调试信息). 默认: notice.
error_log=/data/log/php/error_php-fpm7.log 错误日志文件保存路径
[www] 定义www的pool
user = www 启动进程的帐户
group = www 启动进程组
listen = 127.0.0.1:9999 fpm监听端口,即nginx中php处理的地址
pm = dynamic pm的模式,分为static|dynamic两种
pm.max_children = 50 子进程最大数
pm.start_servers = 10 启动时的进程数
pm.min_spare_servers = 10 保证空闲进程数最小值,如果空闲进程小于此值,则创建新的子进程
pm.max_spare_servers = 50 保证空闲进程数最大值,如果空闲进程大于此值,此进行清理
5.复制服务控制脚本php-fpm到系统服务脚本目录:
cp /opt/php-7.0.14/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm7 && chmod 755 /etc/init.d/php-fpm7
设置php7开启启动:
chkconfig --add php-fpm7
chkconfig php-fpm7 on
启动php:
service php-fpm7 start

 

centos6.5编译安装php7的更多相关文章

  1. Centos6.10编译安装php-7.1.12并安装redis模块

    1.服务器初始化 yum update -yyum install epel-release -yyum install gcc gcc-c++ wget lsof lrzsz telnet -y 2 ...

  2. centos6.5编译安装php7,及配置与nginx通信。

    一.配置编译环境 yum update && yum upgrade yum groupinstall "Development Tools" yum instal ...

  3. centos7.6环境编译安装php-7.2.24修复最新 CVE-2019-11043 漏洞

    先编译安装php-7.2.24,然后编译安装扩展 主版本地址地址:https://www.php.net/distributions/php-7.2.24.tar.gz # 编译 php-7.2.24 ...

  4. 编译安装PHP7并安装Redis扩展Swoole扩展

    编译安装PHP7并安装Redis扩展Swoole扩展 在编译php7的机器上已经有编译安装过php5.3以上的版本,从而依赖库都有了 本php7是编译成fpm-php 使用的, 如果是apache那么 ...

  5. 【安装PHP】如何在openSUSE42.1下编译安装PHP7

    首先推荐一篇文章PHP 7 Release Date Arrived: Will Developers Adopt PHP 7? - PHP Classes blog. 里面说到是否会去使用PHP7, ...

  6. CentOS6.3编译安装Memcached

    要用到如下源码包: /usr/local/src/memcached/libevent-2.0.21-stable.tar.gz /usr/local/src/memcached/memcached- ...

  7. CentOS6.3编译安装Memcached的PHP客户端memcache

    在安装Memcached的PHP客户端memcache之前,可先看下先前的工作笔记: PHP5不重新编译,如何安装自带的未安装过的扩展,如soap扩展? 安装PHP的memcache扩展 cd /us ...

  8. CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28

    [准备工作] #在编译安装lnmp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove httpd yum -y r ...

  9. 【PHP升级】CentOS6.3编译安装 PHP5.4.38

    先前安装的PHP5.3.28(参考:CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28),现在准备升级PHP到5.4.38,有如下几个地方需要重新编译 ...

随机推荐

  1. shell编程:for循环

    有几个参数执行几次 do done取代了{} 这种用于 文件的个数,用户的个数等. (())里才可以进行加减乘除.

  2. 本地tp项目上传服务器报runtime/cache错误

    很简单,给runtime权限777 就好了 chmod -r 777 runctime

  3. UI界面之淡入淡出

    1.using UnityEngine; using System.Collections; using UnityEngine.UI; public class danrudanchu : Mono ...

  4. 将网站项目转为 Web form应用程序(转)

    转自 http://blog.sina.com.cn/s/blog_53729e4601014ze9.html 本文介绍如何将现有的 Microsoft Visual Studio 2005 网站项目 ...

  5. JQuery基本知识(3)

    JQuery基本知识(3) 一.JQuery拥有可操作HTML元素和属性的强大方法. 1.JQuery DOM操作(DOM文档对象模型) 获取内容的方法: text():设置或返回所选元素的文本内容 ...

  6. Yii Listview

  7. 扇入Fan-in和扇出Fan-out

    什么是扇入和扇出? 在软件设计中,扇入和扇出的概念是指应用程序模块之间的层次调用情况. 按照结构化设计方法,一个应用程序是由多个功能相对独立的模块所组成. 扇入:是指直接调用该模块的上级模块的个数.扇 ...

  8. Quick-Cocos2d-x文件结构分析

    在上一章我们讲过了Quick-Cocos2d-x中的环境搭建,这章我们分析下quick中的文件结构吧!打开quick的文件夹,可以看到如下的这些目录和文件: bin:存放各种与引擎相关的脚本 comp ...

  9. QT构建窗体(父窗体传为野指针)异常案例

    [1]源码 工作中,时常会遇到各种各样的异常场景,有些异常场景很常见,必要备录,以防再犯. 分享本案例为:QT创建窗体时parent父窗体传野指针引起异常. 本案例源码如下: 1.1 默认新建一个QT ...

  10. Spring boot FastJson

    介绍:FastJson 是ailibaba 的一款解析Json的开源框架 使用方式1 引入jar 包 <dependency>    <groupId>com.alibaba& ...