Linux Centos7.2 编译安装PHP7.0.2
操作环境:
1.系统:Centos7.2
2.服务:Nginx
1、下载PHP7.0.2的安装包解压,编译,安装:
$ cd /usr/src/
$ wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
$ tar -zxvf php-7.0..tar.gz
$ cd php-7.0.
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. distribution
执行 yum install libxslt-devel
4、编译安装
make clean && make && make install
5、PHP配置
5.1 安装完成后,我们要把源码包中的配置文件复制到PHP安装目录下,源码包中有两个配置 php.ini-development php.ini-production ,看名字就知道,一个是开发环境,一个是生产环境,我们这里就复制开发环境的php配置文件
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./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
本文转自https://www.jb51.net/article/116746.htm
Centos7.2 编译安装PHP7.0.2的步骤
Linux Centos7.2 编译安装PHP7.0.2的更多相关文章
- centos7下编译安装php-7.0.15(PHP-FPM)
centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...
- centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展
centos7.6编译安装php7..11及redis/memcached/rabbitmq/openssl/curl等常见扩展 获取Php的编译参数方法: [root@eus-api-cms-bac ...
- CentOS7下编译安装redis-5.0.9
CentOS7下编译安装redis-5.0.9 本文地址http://yangjianyong.cn/?p=171转载无需经过作者本人授权 下载redis #code start wget https ...
- Linux(CentOS7)下rpm安装MySQL8.0.16
记录一下自己在 CentOS7 下 rpm 安装 MySQL8.0.16 的过程. 一.准备工作 1. 下载MySQL所需要的安装包 从 MySQL官网 下载,上传至 CentOS 系统 /usr/l ...
- centos7.5环境下编译安装php7.0.30并安装redis和mongo扩展
.安装php7..30的脚本 # vim install_php.sh #!/bin/bash # 安装基本依赖 yum install -y gcc gcc-c++ htop telnet ioto ...
- Centos7.2 编译安装PHP7
PHP7,编译安装: 环境:centos7.2 (注意:因为我用的nginx, 此配置参数没有考虑到apache,所以不合适需要用apache的朋友照搬过去运行,但是可以参考.) 直接下载P ...
- CentOS 7.2mini版本下编译安装php7.0.10+MySQL5.7.14+Nginx1.10
一.安装前的准备工作 1.yum update #更新系统 2.yum install gcc gcc-c++ autoconf automake cmake bison m4 libxml2 ...
- CentOS 7.2mini版本下编译安装php7.0.10+MySQL5.7.14+Nginx1.10.1
一.安装前的准备工作 1.yum update #更新系统 1.1)vi /etc/selinux/config # 禁止SELINUX,设置SELINUX=disabled 2.yum in ...
- CentOS 7.2下编译安装PHP7.0.10+MySQL5.7.14+Nginx1.10.1
一.安装前的准备工作 1.yum update #更新系统 2.yum install gcc gcc-c++ autoconf automake cmake bison m4 libxml2 ...
随机推荐
- Lagom学习 (三)
lagom代码中有大量的Lambda表达式,首先补习一下lambda表达式和函数式接口的相关知识. 一: 函数式接口: 函数式接口其实本质上还是一个接口,但是它是一种特殊的接口: 这种类型的接口,使得 ...
- Java基础知识之常见关键字(1)
static 特点: 随着类的加载而加载 优先于对象存在 被所有对象所共享 可以直接被类名调用 注意点: 静态方法只能访问静态方法 但是非静态成员可以直接访问静态成员 静态方法中不可以使用this , ...
- DDD领域事件与事件总线源码下载
最近在看领域事件的文章.看到了“张占岭”的<DDD~领域事件与事件总线> 原文地址:http://www.cnblogs.com/lori/p/3476703.html 遗憾的是没有提供下 ...
- C#自定义控件 类似于Linechart
界面效果: 对外提供的属性设置 /// <summary> /// 背景色 /// </summary> public Color BackColor; /// <sum ...
- Find First and Last Position of Element in Sorted Array
问题:给定一个有序数组和一个目标值,输出目标值在数组中的起始位置和终止位置,如果目标值不在数组中,则输出[-1,-1] 示例: 输入:nums = [1,2,3,5,5,7] target = 5 输 ...
- Git 分支管理 Feature分支 强行删除分支
软件开发中,总有无穷无尽的新的功能要不断添加进来. 添加一个新功能时,你肯定不希望因为一些实验性质的代码,把主分支搞乱了, 所以,每添加一个新功能,最好新建一个feature分支, 在上面开发,完成后 ...
- 51nod1255【贪心-栈的应用】
思路: 大体可以看到:大的越后面越好,但是首先要保证如果他对于一个比他小的字符后面存在他. 主要操作就是利用栈,每次对栈里的元素询问是否比他大,且他的后面还存在. #include<bits/s ...
- [Xcode 实际操作]六、媒体与动画-(7)遍历系统提供的所有滤镜
目录:[Swift]Xcode实际操作 本文将演示系统到底提供了多少滤镜供开发者使用,并了解每个滤镜都有哪些参数需要配置. 在项目导航区,打开视图控制器的代码文件[ViewController.swi ...
- java.lang.NoClassDefFoundError: com/sun/tools/javac/processing/JavacProcessingEnvironment
最近项目用到了java程序动态编译java源文件,运行程序一直报错,提示错误如下: Can't initialize javac processor due to (most likely) a cl ...
- W3C标准以及规范
1.什么是DOCTYPE DOCTYPE是document type(文档类型)的简写,用来说明你用的XHTML或者HTML是什么版本.其中的DTD(例如xhtml1-transitional.dtd ...