centos7 php安装流程
1,从 php官网: http://cn2.php.net/downloads.php 选择需要的php版本,选择.tar.gz 的下载包,选择7.2以上版本
2,安装php所需要的依赖
yum install gcc
yum install libxml2
yum install libxml2-devel -y
yum install openssl openssl-devel -y
yum -y install curl-devel
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 bzip2-devel.x86_64 -y
yum install libXpm-devel -y
yum install gmp-devel -y
yum install -y icu libicu libicu-devel
yum install php-mcrypt libmcrypt libmcrypt-devel -y
yum install postgresql-devel -y
yum install libxslt-devel -y
yum -y install libjpeg-devel
yum -y install readline-devel
3,解压编译
tar -xzxvf php-7.2.0.tar.gz
cd php-7.2.0
设置编译需要加载的模块
./configure \
--prefix=/data/service/php\
--enable-fpm\
--with-fpm-user=www\
--with-fpm-group=www\
--with-config-file-path=/data/conf/php\
--disable-rpath\
--enable-soap\
--with-libxml-dir\
--with-xmlrpc\
--with-openssl\
--with-mhash\
--with-pcre-regex\
--with-zlib\
--enable-bcmath\
--with-bz2\
--enable-calendar\
--with-curl\
--enable-exif\
--with-pcre-dir\
--enable-ftp\
--with-gd\
--with-openssl-dir\
--with-jpeg-dir\
--with-png-dir\
--with-zlib-dir\
--with-freetype-dir\
--enable-gd-jis-conv\
--with-gettext\
--with-gmp\
--with-mhash\
--enable-mbstring\
--with-onig\
--with-mysqli\
--with-pdo-mysql\
--with-zlib-dir\
--with-readline\
--enable-shmop\
--enable-sockets\
--enable-sysvmsg\
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx\
--with-xsl\
--enable-zip\
--with-pear\
--enable-pcntl\
--with-iconv\
--enable-opcache\
--enable-mbregex\
--with-pcre-regex
编译:
make clean && make && make install
安装成功
-----------------------------------------------------------------------------
配置php
1. 复制配置文件
cp php.ini-development /data/service/php/etc/php.ini
2. 设置全局的php命令
vim /etc/profile
在文件最后添加:
PATH=$PATH:/data/service/php/bin
export PATH
然后执行 命令 source /etc/profile
此时php就是全局命令了,可以通过php -v 查看php版本信息或者php -m 看看刚刚编译加载的模块了
3,配置PHP-fpm
cp /data/service/php/etc/php-fpm.conf.default /data/service/php/etc/php-fpm.conf
cp /data/service/php/etc/php-fpm.d/www.conf.default /data/service/php/etc/php-fpm.d/www.conf
cp /usr/src/php-7.2.0/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
新建www 用户组:
groupadd www
useradd -g www www
启动php-fpm
/etc/init.d/php-fpm start
(可选)配置php-fpm自启动,如果存在这个文件,这步省略
创建php-fpm启动脚本
vim /etc/init.d/php-fpm
1
插入如下内容:
#!/bin/sh
# chkconfig: 2345 15 95
# description: PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation \
# with some additional features useful for sites of any size, especially busier sites.
# DateTime: 2016-09-20
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
phpfpm="/usr/local/php/sbin/php-fpm"
prog=$(basename ${phpfpm})
lockfile=/var/lock/subsys/phpfpm
start() {
[ -x ${phpfpm} ] || exit 5
echo -n $"Starting $prog: "
daemon ${phpfpm}
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc ${phpfpm} -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
${phpfpm} -t
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|configtest}"
exit 2
esac
添加到开机启动项
chkconfig --add php-fpm
此时也可以使用service来启动php-fpm了
service php-fpm start
service php-fpm stop
centos7 php安装流程相关推荐
- CentOS7的安装流程
CentOS7的安装流程 1. 环境准备 安装VMware 下载Centos7镜像文件 2. CentOS7安装流程 步骤一:打开VMware,点击创建新的虚拟机 步骤二:选择典型安装,点击下一步 步 ...
- CentOS7 网络安装流程
一直就很想通过网络安装一下我钟爱的linux系统,老是搞不定,昨天花了一整天的时间来琢磨研究,功夫不负有心人,搞定啦!highing(妹的,怕用错单词 去查了下,妹的字典也骗人)我就要highing ...
- 【达梦数据库】VMware虚拟机 + CentOS7环境配置 + DM8 数据库安装流程
文章目录 前言 一.前期准备 1.1 VMware安装 1.2 CentOS下载 1.3 DM8下载 1.4 SecureCRT安装 二.CentOS7环境搭建 2.1 虚拟机创建 2.2 网络配置 ...
- (绝对正确)Zabbix基于lamp的安装流程
目录 Zabbix基于lamp的安装流程... 1 1安装Mysql... 1 先安装相关的库和工具... 1 Mysql的安装... 1 2httpd的安装... 2 先安装相关的库和工具... 2 ...
- linux安装nginx1.9,CentOS7.2安装Nginx 1.9
今天在最新的centos7.2上安装nginx1.9,希望安装流程对你有所帮助,一定要查看对应centos的版本. 一.确认一下centos的版本 [root@localhost ~]# cat /e ...
- FastDFS介绍并在centos7中安装
文章目录 FastDFS介绍 什么是FastDFS FastDFS安装 一.安装gcc环境libfastcommon 二.安装FastDFS 三.编辑tracker.conf: 四.修改storage ...
- 在centos7.7安装搜狗输入法踩坑日记
1.踩过的坑 直接卸载了ibus 由于我用的是GNOME桌面,很多部分和ibus是有依赖关系的,如果不使用–nodeps进行ibus的单独卸载,而是直接卸载的话,那么会导致整个桌面崩掉.装回来确实很容 ...
- Centos7 二进制安装 Kubernetes 1.13
目录 1.目录 1.1.什么是 Kubernetes? 1.2.Kubernetes 有哪些优势? 2.环境准备 2.1.网络配置 2.2.更改 HOSTNAME 2.3.配置ssh免密码登录登录 2 ...
- CentOS7下安装使用HBase
目录 背景 数据结构 安装 启动hadoop.kafka.ZooKeeper 解压hbase压缩包 配置HBase 启动hbase 关闭hbase 进入hbase命令行 命令 创建表,指定列族 插入数 ...
最新文章
- Python并发编程实例教程
- 使用扩展的 CodeIgniter 框架实现 RESTful 框架
- java-Random类
- python 设计 实践_Python程序设计实践教程
- SpringBoot打成jra包启动时读取外部配置文件实现动态配置
- oauth password模式_SpringBoot OAuth2.0 认证授权(密码模式)
- java 对 redis 的基本操作
- android app性能优化_Android性能优化之Apk 瘦身优化
- 少儿编程几种语言_您使用了几种编程语言?
- SpringBoot 如何统计、监控 SQL运行情况?
- CLin 和 IDEA创建文件时自动添加作者和时间信息 + 多个.cpp文件在CLion下运行问题...
- 星星评价控件android开发_Android自定义View,评分星星控件(RatingBar)
- 浮窗 动画特效 android,悬浮窗能实现自定Animation动画效果吗?
- [GRE] 填空机经 Section51-55
- CTF之做题总结(二)
- linux集群环境搭建
- 软件工程实践 Blog5
- mysql的windows安装步骤_windows下mysql安装配置教程
- out在matlab中,在仿真模型中添加一个输出端口模块(Out模块),能够将结果输出到MATLAB工作空间中。...
- 信息系统项目管理师考试中涉及到的法律法规知识