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


猜你喜欢
- 一,引言开发环境:Pycharm操作系统:Windows 10Pyhon版本:3.9.9需要自行安装Pygame 3(必须)和Python(
- 自开始做项目以来,一直在用。这段存储过程的的原创者(SORRY,忘记名字了),写得这段SQL代码很不错,我在这个基础上,按照我的习惯以及思维
- dotnet run 介绍dotnet 相关命令是属于 .NET Core command-line (CLI) 的一部分,Microsof
- 试官: 听说你熟悉python,那么你能简单阐述一下python的装饰器、生成器以及迭代器么?我: emm, 我不清楚,我只是了解过pyth
- 前段时间喜欢用python去抓一些页面玩,但都基本上都是用get请求一些页面,再通过正则去过滤。今天试了一下,模拟登陆个人网站。发现也比较简
- 目的:让在vuex中管理的状态数据同时存储在本地。可免去自己存储的环节。在开发的过程中,像用户信息(名字,头像,token)需要vuex中存
- 本文实例为大家分享了一个简单的小游戏,分享给大家。利用随机函数制作石头剪刀布小游戏程序只运行一次import randoma = input
- PySide是一个免费的软件,与PyQt不同之处在于使用了LGPL,允许PySide免费的开发商业软件。 PySide有15个模块。这些模块
- 新闻系统,相册系统可以用用哦,简单实用,有兴趣的可以自己扩充!^_^相册截图:<?xml version="1.0"
- 1,FCKeditor 编辑器最新版本: 2.3.1站点:http://www.fckeditor.net 演示:http://w
- 本文实例讲述了Flask框架各种常见装饰器。分享给大家供大家参考,具体如下:效果类似django的process_request的装饰器@a
- Python脚本编辑使用Python对fasta格式的序列进行基本信息统计预期设计输出文件中包括fasta文件名,序列长度,GC含量以及AT
- 一、Python短信发送界面最后的效果二、准备:注册腾讯云账号并配置短信功能(1)注册腾讯云账号登录腾讯云网址(2)获取AppID、AppK
- 一、进程与线程1.进程我们电脑的应用程序,都是进程,假设我们用的电脑是单核的,cpu同时只能执行一个进程。当程序出于I/O阻塞的时候,CPU
- Vue导航栏 用Vue写手机端的项目,经常会写底部导航栏,
- 1、Bootstrap-table使用github:https://github.com/wenzhixin/bootstrap-table
- 回调函数用起来比较爽。特别是在js中,满世界全是回调,那么在python中,怎么来优雅地实现自己的回调函数呢下面贴一个我写的例子class
- 前言项目中一般分测试环境(QAS),生产环境(PRD),当我们的项目经历了一次周期跨度较长的更新后,当我们发布到生产环境时,首要的任务是将新
- 在本文中,此示例标准蓝图的存储过程命名方法只适用于SQL内部,假如你正在创建一个新的存储过程,或是发现一个没有按照这个标准构造的存储过程,即
- 大致介绍在python爬虫爬取某些网站的验证码的时候可能会遇到验证码识别的问题,现在的验证码大多分为四类:1、计算验证码 &nbs