下载php

yum install -y wget
wget http://cn2.php.net/distributions/php-7.1.21.tar.gz

解压

tar -zxvf php-7.1.21.tar.gz
cd php-7.1.21

编译:

# 安装epel
yum install -y epel-release
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# 安装编译依赖
yum install -y libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel \
libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \
gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel gcc
# 创建目录
mkdir -p /data/service/php/etc
./configure \
--prefix=/data/service/php \
--with-config-file-path=/data/service/php/etc \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache
make && make install

增加环境变量

cat <<EOF > /etc/profile.d/php.sh
export PATH=/data/service/php/bin:\$PATH
EOF
# 生效环境变量
. /etc/profile

配置php-fpm

cp php.ini-production /data/service/php/etc/php.ini
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

配置php-fpm服务

# 注意:这个文件是根据上面C++编译配置动态生成的文件,里面写了上面配置的路径
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# 启动权限
chmod +x /etc/init.d/php-fpm

启动:

# 增加开机启动
systemctl enable php-fpm
systemctl start php-fpm

注意:php-fpm需要nginx用户,当然你可以自行增加,也可以直接安装nginx。

自动化脚本:

https://github.com/easonjim/centos-shell/blob/master/php/install-php_7.1.21.sh

参考:

https://blog.csdn.net/tojohnonly/article/details/78680633

CentOS 7解压安装PHP7.1.21的更多相关文章

  1. CentOS 7解压安装PHP5.6.13

    自动化脚本: https://github.com/easonjim/centos-shell/blob/master/php/install-php_5.6.13.sh

  2. mysql zip 解压安装

    系统:win10 专业版 mysql 5.7.21 解压安装. 对于Windows,mysql官网推荐使用可执行文件进行安装,这里我还是暂时用noinstall 解压zip文件来安装 zip 文件解压 ...

  3. Windows解压安装mysql 5.7.24,并部署多个mysql服务

    mysql官网windows安装文档 https://dev.mysql.com/doc/refman/5.7/en/windows-installation.html 第一步,选择安装包   htt ...

  4. Linux(CentOS-7) 下载 解压 安装 redis 操作的一些基本命令

    使用xshell 连接到虚拟机,并且创建 一个redis目录:创建文件命令:mkdir 文件名ls:查看当前文件里面的所有文件 使用xftp 将下载的linux版本 reids上传动新建的redis目 ...

  5. debian 8 解压安装mysql(版本5.7.19)

    debian 8 解压安装mysql(版本5.7.19)一.下载 根据目标主机的型号官网下载mysql安装包如: mysql-server_5.7.19-1debian8_amd64.deb-bund ...

  6. 解压安装的tomcat, 使用chkconfig命令让tomcat 随机启动,tomcat 变为系统服务

    使用解压安装的tomcat包,命令行输入 service tomcat start 会报 tomcat: unrecognized service 错误提示,意思是说系统没有找到该服务. 好了,我们现 ...

  7. MySQL v5.7.18 版本解压安装

    下载MySQL https://dev.mysql.com/downloads/mysql/5.1.html#downloads 个人机子是64位的,所以选择下载:Windows (x86, 64-b ...

  8. centos tomcat解压版安装

    解压: tar -xzvf apache-tomcat-8.5.23.tar.gz -C /usr/local/java 配置Tomcat的环境变量: export CATALINA_HOME=/us ...

  9. CentOS直接解压可用的memcached、nginx、keepalived

    Centos均基于x86_64版本,下面相关文件编译时使用用户组为www,用户为www 相关命令: groupadd -r www useradd -r -g www -M www memcached ...

随机推荐

  1. 第一、介绍Canvas

    canvas能做什么? canvas是HTML5中的新元素,你可以使用javascript用它来绘制图形.图标.以及其它任何视觉性图像.它也可用于创建图片特效和动画.如果你掌握了完整的命令,你可以用c ...

  2. 控制台console对象常用的一些方法

    console.log():调试中最常用的方法,用于在控制台窗口显示信息. console.log(123); console.warn():输出信息时,在最前面加一个黄色三角,表示警告 consol ...

  3. 利用JS实现图片的缓存

    web页面使用HTML的<img>元素来嵌入图片,和所有HTML元素一样,<img>元素也是可以通过脚本来操控的(设置元素的src属性,将其指向一个新的URL会导致浏览器载入并 ...

  4. python中的__iter__ __reversed__ __next__

    __reversed__ 返回集合的倒叙迭代器,如果没有实现这个方法,reversed()会去使用__getitem__和__len__来实现 介绍__next__和 __iter__方法需要了解下可 ...

  5. 关于cookie和session

    在设置cookie的时候,它会保留在本地,无论你有没有退出浏览器都是.但是session只能在登录状态有效.退出浏览器过后就会消除掉.同时设置也是有问题的. @app.route('/login',m ...

  6. order by 字段自动填写脚本

    新版 firefox 中的 hackbar 没有 order by 字段填写, 所以就有了这个: =begin pod sql注入中自动输出order by 的位数 =end pod sub MAIN ...

  7. 【Python】使用Python将Shellcode转换成汇编

    1.介绍 需要多少行代码转换hex成反汇编呢? 多亏了Python的Capstone库,做这件事只需要五行. 在二进制分析中,进行Exploit开发或逆向工程时,需要快速将十六进制的Shellcode ...

  8. mysql主从复制跳过复制错误【转】

    跳过复制错误 mysql因为binlog机制问题,有些时候会出现从库重放sql执行失败的情况,特别是旧的STATEMENT模式最容易出现这种情况(因为函数和存储过程等原因),这也是为什么强调使用mix ...

  9. centos6 安装EPEL

    一.安装 32位系统: rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm rpm --i ...

  10. Project Euler Problem1

    Multiples of 3 and 5 Problem 1 If we list all the natural numbers below 10 that are multiples of 3 o ...