Centos7.2 编译安装PHP7.0.2的步骤
作者:hyperbolaa 发布时间:2023-10-08 12:51:29
标签:Centos,编译,安装,PHP
环境
系统:Centos7.2
服务:Nginx
1:下载PHP7.0.2的安装包解压,编译,安装:
$ cd /usr/src/
$ wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
$ tar -xzxvf php-7.0.2.tar.gz
$ cd php-7.0.2
1.1编译前检查
请检查是否安装了gcc ,没有的话执行yum install gcc
检查是否安装了libxml2 ,没有的话执行yum install libxml2
检查是否安装了libxml2-devel,没有的话执行yum install libxml2-devel
注:因为改为用nginx了,所以编译参数中的--with-apxs2=/usr/bin/apxs去掉了,如果要配置apache用,安装PHP前,请先安装apache。*
2:编译参数配置
'./configure' '--prefix=/usr/local/php' '--with-pdo-pgsql' '--with-zlib-dir' '--with-freetype-dir' '--enable-mbstring' '--with-libxml-dir=/usr' '--enable-soap' '--enable-calendar' '--with-curl' '--with-mcrypt' '--with-gd' '--with-pgsql' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-zlib' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-pcntl' '--enable-mbregex' '--enable-exif' '--enable-bcmath' '--with-mhash' '--enable-zip' '--with-pcre-regex' '--with-pdo-mysql' '--with-mysqli' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--with-openssl' '--with-fpm-user=www-data' '--with-fpm-group=www-data' '--with-libdir=/lib/x86_64-linux-gnu/' '--enable-ftp' '--with-gettext' '--with-xmlrpc' '--with-xsl' '--enable-opcache' '--enable-fpm' '--with-iconv' '--with-xpm-dir=/usr'
3:错误集合
报错 Cannot find OpenSSL's <evp.h>
执行 yum install openssl openssl-devel
报错 Please reinstall the libcurl distribution
执行 yum -y install curl-devel
错误 jpeglib.h not found
执行 yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y
和执行 yum install libjpeg-devel
错误:checking for BZip2 in default path... not found configure: error: Please reinstall the BZip2 distribution 这是bzip2软件包没有安装
执行 yum install bzip2-devel.x86_64 -y
错误:configure: error: xpm.h not found.
执行 yum install libXpm-devel
错误: Unable to locate gmp.h
执行 yum install gmp-devel
错误:Unable to detect ICU prefix or /usr//bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works
执行 yum install -y icu libicu libicu-devel
错误:mcrypt.h not found. Please reinstall libmcrypt.
执行 yum install php-mcrypt libmcrypt libmcrypt-devel
错误: configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
执行 yum install postgresql-devel
错误: configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
执行 yum install libxslt-devel
4:编译
make clean && make && make install
5:PHP配置
5.1安装完成后,我们要把源码包中的配置文件复制到PHP安装目录下,源码包中有两个配置 php.ini-development php.ini-production ,看名字就知道,一个是开发环境,一个是生产环境,我们这里就复制开发环境的
cp php.ini-development /usr/local/php/lib/php.ini
5.2另外还需要设置环境变量 :修改/etc/profile文件使其永久性生效,并对所有系统用户生效,在文件末尾加上如下两行代码
PATH=$PATH:/usr/local/php/bin
export PATH
5.3 然后执行生效命令
source /etc/profile
5.4查看PHP版本信息
php -v
6:配置PHP-fpm
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp /usr/src/php-7.0.2/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
6.1 启动php-fpm:
/etc/init.d/php-fpm start
6.2 如果出现错误:ERROR: [pool www] cannot get uid for user 'www-data'
则新建www-data 用户组:
groupadd www-data
useradd -g www-data www-data
6.3 重启php-fpm
/etc/init.d/php-fpm restart
来源:http://www.jianshu.com/p/812b28819715
0
投稿
猜你喜欢
- 在cssplay网站看到有一组CSS像素画,于是也想摩仿一下,于是在网络上找到一组头像图标,看其结构比较简单,就拿它开刀吧!先看看预览图图一
- 下一代的 web 已经开始上路了,就在这个星期,MySpace 集成了 Google Gears,雅虎发布了新的 BrowserPlus,G
- 1.SQL Server 2005中的存储过程并发问题问:我在SQL Server2005中遇到了并发问题。我持有车票的公共汽车上有一些空闲
- 我见朋友可以把数据库的记录显示到列表框里去,挺实用,也想做一个。怎么做啊?这简单,代码和说明如下:dblist.asp<html>
- 这个可以说属性选择符的JS版,用来遴选元素是适合不过。在开始之前,我们复习一下CSS2的属性选择符,JQuery高手可以跳过。属性选择符:名
- 举例如下:<HTML> <HEAD>  
- 本文实例为大家分享了python实现抖音点赞功能的具体代码,供大家参考,具体内容如下#coding=utf-8from time impor
- 似乎讨论分页的人很少,难道大家都沉迷于limit m,n?在有索引的情况下,limit m,n速度足够,可是在复杂条件搜索时,where s
- 1. 关于上传图片失败的问题首先导入jar包 commons-fileupload-1.2.2.jar,ueditor.jar然后修改edi
- 代码如下:SELECT * FROM Orders WHERE OrderGUID IN('BC71D821-9E25-
- 1、控制"纵打"、 横打”和“页面的边距。 (1)<script defer> function SetPr
- 原文地址:30 Days of Mootools 1.2 Tutorials - Day 2 - Selectors如果你还没有准备好,请先
- 我的PJBlog在从2.7升级的3.0的时候,犹豫了很久。升级到PJBlog3.0就是看中了新增的静态页面功能,但是同时又担心造成博客出现大
- 由于ACCESS本身没有提供在窗体中添加一个命令按钮实现打开通用对话框的控件,所以大家必须通过编写相关的宏才能实现此功能,但是编写出的宏限制
- sql server中变量要先申明后赋值:局部变量用一个@标识,全局变量用两个@(常用的全局变量一般都是已经定义好的);申明局部变量语法:d
- 二是什么时候CPU是空闲的?空闲是一个相对的标准。有时会CPU使用率30%以下可以定义为空闲;而有时候CPU使用率只有不到60%,就是空闲。
- PHP chunk_split() 函数实例在每个字符后分割一次字符串,并在每个分割后添加 ".":<?php $
- 在url网址中,我们经常使用server.urlencode来对网址进行编码,特别是遇到网址中有中文字符的时候,如<a href=&q
- 问: 如果数据表中有时间字段,现在要迁移到其他时区的服务器上,该如何处理呢?答:在高版本的mysqldump中,新增了一个选项:--tz-u
- MYSQL数据库安装完成后,默认最大连接数是100,一般流量稍微大一点的论坛或网站这个连接数是远远不够的,增加默认MYSQL连接数的方法有两