安装依赖包:

1、安装yasm

cd /usr/local/src

tar zxvf yasm-1.3.0.tar.gz

cd yasm-1.3.0

./configure

make

make install

2、安装libmcrypt

cd /usr/local/src

tar zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure

make

make install

3、安装libvpx

cd /usr/local/src

tar zxvf libvpx-1.3.0.tar.gz

cd libvpx-1.3.0

./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9

make

make install

4、安装tiff

cd /usr/local/src

tar zxvf tiff-4.0.7.tar.gz

cd tiff-4.0.7

./configure --prefix=/usr/local/tiff --enable-shared

make

make install

5、安装libpng

cd /usr/local/src

tar zxvf libpng-1.6.28.tar.gz

cd libpng-1.6.28

./configure --prefix=/usr/local/libpng --enable-shared

make

make install

6、安装freetype

cd /usr/local/src

tar zxvf freetype-2.7.1.tar.gz

cd freetype-2.7.1

./configure --prefix=/usr/local/freetype --enable-shared

make

make install

7、安装jpeg

cd /usr/local/src

tar zxvf jpegsrc.v9b.tar.gz

cd jpeg-9b

./configure --prefix=/usr/local/jpeg --enable-shared

make

make install

8、安装libgd

cd /usr/local/src

tar zxvf libgd-2.1.1.tar.gz

cd libgd-2.1.1

./configure \
--prefix=/usr/local/libgd \
--enable-shared \
--with-jpeg=/usr/local/jpeg \
--with-png=/usr/local/libpng \
--with-freetype=/usr/local/freetype \
--with-fontconfig=/usr/local/freetype \
--with-xpm=/usr/lib64 \
--with-tiff=/usr/local/tiff \ make make install

说明:如果libgd编译失败,可以先跳过,直接使用系统默认的2.1.0版本,在编译php的时候把参数--with-gd=/usr/local/libgd修改为--with-gd即可。

9、安装t1lib

cd /usr/local/src

tar zxvf t1lib-5.1.2.tar.gz

cd t1lib-5.1.2

./configure --prefix=/usr/local/t1lib --enable-shared

make without_doc

make install

安装PHP

\cp -frp /usr/lib64/libltdl.so* /usr/lib/

\cp -frp /usr/lib64/libXpm.so* /usr/lib/

export LD_LIBRARY_PATH=/usr/local/libgd/lib

./configure \
--prefix=/usr/local/php71 \
--with-config-file-path=/usr/local/php71/etc \
--with-mysqli=mysqlnd \
--with-mysql-sock=/tmp/mysql.sock \
--with-pdo-mysql=mysqlnd \
--with-gd=/usr/local/libgd \
--with-png-dir=/usr/local/libpng \
--with-jpeg-dir=/usr/local/jpeg \
--with-freetype-dir=/usr/local/freetype \
--with-xpm-dir=/usr/lib64 \
--with-zlib-dir=/usr/local/zlib \
--with-iconv \
--enable-libxml \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-opcache \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-mcrypt \
--with-curl \
--enable-ctype \
--enable-mysqlnd \ make && make install

启动服务

vi /usr/lib/systemd/system/php-fpm.service

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target [Service]
Type=simple
PIDFile=/run/php-fpm.pid
ExecStart=/usr/local/php71/sbin/php-fpm --nodaemonize --fpm-config /etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID [Install]
WantedBy=multi-user.target

配置

cp php.ini-production /usr/local/php71/etc/php.ini #复制php配置文件到安装目录

mv /etc/php.ini /etc/php.ini.old #删除系统自带配置文件

ln -s /usr/local/php71/etc/php.ini /etc/php.ini #添加软链接到 /etc目录

cp /usr/local/php71/etc/php-fpm.conf.default /usr/local/php71/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件

ln -s /usr/local/php71/etc/php-fpm.conf /etc/php-fpm.conf #添加软连接到 /etc目录

vi /usr/local/php71/etc/php-fpm.conf

pid = run/php-fpm.pid #取消前面的分号

include=/usr/local/php71/etc/php-fpm.d/*.conf

cp /usr/local/php71/etc/php-fpm.d/www.conf.default /usr/local/php71/etc/php-fpm.d/www.conf

vi /usr/local/php71/etc/php-fpm.d/www.conf #编辑

user = www #设置php-fpm运行账号为www,此账号是nginx等web服务的账号

group = www #设置php-fpm运行组为www

listen = 127.0.0.1:9000

vi /usr/local/php71/etc/php.ini #编辑配置文件

找到:disable_functions =

修改为:disable_functions =

passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname

修改为:date.timezone = PRC #设置时区 Asia/Shanghai

修改为:expose_php = Off #禁止显示php版本的信息

修改为:short_open_tag = ON #支持php短标签

修改为opcache.enable=1 #php支持opcode缓存

修改为:opcache.enable_cli=0

在最后一行添加:zend_extension=opcache.so #开启opcode缓存功能

配置nginx支持php

测试篇

最新文章

  1. 解决osg路径与文件名中的中文字符问题
  2. Multiply game_线段树
  3. Visible 绑定
  4. Codeforces Round #290 (Div. 2) D. Fox And Jumping dp
  5. Android中的动画学习总结
  6. C# if,ifelse语句
  7. Service Trace Viewer Tool (SvcTraceViewer.exe)
  8. numpy 安装
  9. Shader 入门笔记(二) CPU和GPU之间的通信,渲染流水线
  10. mybatis源码笔记
  11. 菜鸟使用MySQL存储过程and临时表,供新手参考,请高手斧正
  12. Vscode下的Markdown的基本使用
  13. python 购物车小程序
  14. 6.MongoDB4.0在Windows环境的下载、安装、配置
  15. MySQL驱动和数据库字符集设置不搭配
  16. POJ 2501
  17. SpringMvc+JavaConfig+Idea 基于JavaConfig搭建项目
  18. django 远程数据库mysql migrate失败报error 1045之 解决方案
  19. NCE2
  20. 什么是AOP-面向交叉业务编程

热门文章

  1. 做c语言的码农专业发展方向
  2. 【机器学习】关联规则分析(一):Apriori
  3. java第一天--Java开发环境的搭建以及使用eclipse从头一步步创建java项目
  4. 商派OMS增加PMC跟生产中心角色权限思路
  5. const define区别
  6. JSP-模拟银行卡账号密码登录页面跳转
  7. 安居客scrapy房产信息爬取到数据可视化(上)-scrapy爬虫
  8. Jmeter_拦截Excel文件输出流到本地
  9. 原生JS实现雪花特效
  10. Eclipse(2019-03版本)汉化