[TOC]
## 编译安装php7.1.27
### 1.下载php7.1.27源码包
```
$ cd /root & wget -O php7.1.27.tar.gz http://cn2.php.net/get/php-7.1.27.tar.gz/from/this/mirror
```
### 2.解压源码包
```
$ tar -xvf php7.1.27.tar.gz
```
### 3.进入目录
```
$ cd php-7.1.27
```
### 4.安装php依赖包
```
$ yum install 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
```
### 5.编译配置,这一步我们会遇到很多`configure error`,我们一一解决,基本都是相关软件开发包没有安装导致
```
$ ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/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
```
安装完成如图:
```
Thank you for using PHP.
config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/www.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
```
### 6.编译与安装
```
$ make && make install
```
这里要make好久,要耐心一下,结果如下:
```
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/
Installing PHP CLI binary: /usr/local/php/bin/
Installing PHP CLI man page: /usr/local/php/php/man/man1/
Installing PHP FPM binary: /usr/local/php/sbin/
Installing PHP FPM config: /usr/local/php/etc/
Installing PHP FPM man page: /usr/local/php/php/man/man8/
Installing PHP FPM status page: /usr/local/php/php/php/fpm/
Installing phpdbg binary: /usr/local/php/bin/
Installing phpdbg man page: /usr/local/php/php/man/man1/
Installing PHP CGI binary: /usr/local/php/bin/
Installing PHP CGI man page: /usr/local/php/php/man/man1/
Installing build environment: /usr/local/php/lib/php/build/
Installing header files: /usr/local/php/include/php/
Installing helper programs: /usr/local/php/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php/lib/php/
[PEAR] Archive_Tar - already installed: 1.4.0
[PEAR] Console_Getopt - already installed: 1.4.1
[PEAR] Structures_Graph- already installed: 1.1.1
[PEAR] XML_Util - already installed: 1.3.0
[PEAR] PEAR - already installed: 1.10.1
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/php-7.0.8/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
```
### 7.添加 `PHP` 命令到环境变量
```
$ vim /etc/profile
```
在末尾加入
```
PATH=$PATH:/usr/local/php/bin
export PATH
```
要使改动立即生效执行
```
$ source /etc/profile
```
查看环境变量
```
$ echo $PATH
```
查看php版本
```
$ php -v
```
操作如图:
![mark](http://qiniu.newthink.cc/blog/20180103-150000109.png)
### 8.配置`php-fpm`
```
$ cp /root/php-7.1.27/php.ini-production /etc/php.ini
$ 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 /root/php-7.1.27/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
$ chmod +x /etc/init.d/php-fpm
```
### 9.启动`php-fpm`
```
$ /etc/init.d/php-fpm start
```
- centos
- 安装工具
- 安装nginx
- 安装PHP5
- 安装PHP7.0.1
- 安装PHP7.0.8
- 安装redis
- redis允许远程访问
- 安装php之redis扩展
- 安装mysql
- 配置nginx虚拟机绑定域名
- xdebug下载配置
- phpStorm远程调试配置
- 报错解决:安装PHP7解决问题方法
- 报错解决:xdebug-解决问题
- yum丢失的解决办法
- CentOS下安装JDK的四种方法
- workman
- 某服务器配置情况
- 安装PHP7.2.17
- 安装PHP7.1.27
- 安装MongoDB
- ubuntu
- mac
- window
- phpstrom+wamp+xdebug
- mysql
- MySql创建本地用户和远程用户 并赋予权限
- 自建主从复制-mycat
- 数据库优化
- 阿里云mysql主从复制
- 报错解决
- SQL分析
- group by
- Mysql定时备份数据脚本
- MySQL数据库远程连接开启方法
- 启动报错systemctl status
- 日志导出
- mysq进程
- mysql查询正在执行的进程
- 命令
- nginx
- 安装GIT
- access.log
- error.log分析
- 500 Internal Server Error错误
- 502解决方案
- 405 Not Allowed,nginx静态文件响应post请求
- Linux基本操作
- 创建用户
- chmod命令详细用法设置文件的权限
- chown命令
- chgrp命令:改变文件的群组
- Linux 设置定时任务crontab命令
- 其他问题
- Win10 Subsystem Linux : Ubuntu 的root密码
- 安全问题
- PHP安全设置
- redis
- 安装
- 安装2.8.17
- 问题
- 日志分析
- an upstream response is buffered to a temporary file
- too many open files
- worker_connections are not enough
- recv() failed
- 日志
- 系统日志
- apache访问日志与错误日志
- nginx访问日志与错误日志
- php错误日志
- php-fpm慢日志
- mysql慢日志
- 服务器优化
- php-fpm进程数优化
- 服务器安全
- RHSA-2018:2748: kernel security and bug fix update
- RHSA-2018:3408: git security update
- RHSA-2018:2570: bind security update
- RHSA-2018:3052: wget security and bug fix update
- RHSA-2018:3221: openssl security, bug fix, and enhancement update
- RHSA-2018:2384: kernel security and bug fix update
- RHSA-2018:3032: binutils security, bug fix, and enhancement update
- RHSA-2018:3157: curl and nss-pem security and bug fix update
- RHSA-2018:2285: yum-utils security update
- RHSA-2018:3092: glibc security, bug fix, and enhancement update
- CVE-2018-17182 on Ubuntu 14.04 LTS (trusty)
- CVE-2018-9415 on Ubuntu 14.04 LTS (trusty)
- CVE-2018-8043 on Ubuntu 14.04 LTS (trusty)
- CVE-2018-3620 on Ubuntu 14.04 LTS (trusty)
- CVE-2018-14634 on Ubuntu 14.04 LTS (trusty)
- CVE-2018-14609 on Ubuntu 14.04 LTS (trusty)
- CentOS Linux 7安全基线检查
- Redis安全基线检查
- RHSA-2019:1168-重要: 内核 安全更新
- RHSA-2019:1481-重要: 内核 安全更新
- RHSA-2019:0512-重要: 内核 安全和BUG修复更新
- ThinkPHP漏洞
- ThinkPHP 5.1.X <= 5.1.30 远程代码执行漏洞
- ThinkPHP 5 <=5.0.22 远程代码执行高危漏洞
- ThinkPHP <5.0.24 Request.php 远程代码执行漏洞
- PHP
- 怎样获取PHP各种版本
- 攻击
- SSH暴力破解
- RDP暴力破解
- SQLSERVER暴力破解
- MYSQL暴力破解
- FTP暴力破解
- SQL注入
- 代码执行
- XSS攻击
- 本地文件包含
- 远程文件包含
- 脚本木马
- 上传漏洞
- 路径遍历
- 越权访问
- CSRF
- CRLF
- 其他