centos7.2 64位安装php7.2.12

Posted jackspider

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7.2 64位安装php7.2.12相关的知识,希望对你有一定的参考价值。

1  安装php所需要的扩展
   
     yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel  gd gd-devel 

  

 

2 安装php
 
   ./configure --prefix=/usr/local/php7.2 --enable-shared --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-libxml-dir --with-openssl --with-curl --with-zlib-dir -with-gettext --with-jpeg-dir --with-png-dir --with-bz2 --with-freetype-dir --with-iconv --with-config-file-path=/usr/local/php7.2/etc --enable-mbstring --with-gd --disable-debug --enable-short-tags --disable-posix --enable-exif --enable-ftp --enable-sockets --with-mhash --enable-zip --enable-opcache --enable-inline-optimization
    
   make

   make install

   cp php.ini-production /usr/local/php7.2/etc/php.ini
    

 

 

   

3 编辑php配置文件
   
   编辑 php.ini文件  设置如下
 
short_open_tag = On
 
disable_functions = "dl,exec,passthru,pcntl_exec,popen,posix_kill,posix_mkfifo,posix_setuid,proc_close,proc_open,proc_terminate,shell_exec,system,leak,posix_setpgid,posix_setsid,proc_get_status,proc_nice,show_source"
 
cgi.fix_pathinfo=0
 
date.timezone = Asia/Shanghai
expose_php = Off

  

   

4 编辑php-fpm配置文件

cp php-fpm.conf.default  php-fpm.conf
  
  编辑  php-fpm.conf  设置如下
 
  pid = /usr/local/php7/var/run/php-fpm.pid
   
  error_log = log/php-fpm.log
 
  log_level = notice
   
   process_control_timeout = 30
 
  events.mechanism = epoll
 
  listen = 127.0.0.1:9007
   
   listen.backlog = -1
   
   pm.max_children = 1024
 
    pm.start_servers = 80
    
    pm.min_spare_servers = 20
 
    pm.max_spare_servers = 80
 
    pm.max_requests = 2000
 
    pm.status_path = /status
 
    ping.path = /ping
    
    ping.response = pong
 
    slowlog =  var/log/phpslow_$pool.log
 
    request_slowlog_timeout = 5s
    
    request_terminate_timeout = 60s
 
     rlimit_files = 65534
 
    php_admin_value[open_basedir] = "/tmp/"
php_admin_value[disable_functions] = dl,exec,leak,passthru,pcntl_exec,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system

 

 

     

4 测试php
 
   #测试php-fpm配置
/usr/local/php7.2/sbin/php-fpm -t
/usr/local/php7.2/sbin/php-fpm -c /usr/local/php7/etc/php.ini -y /usr/local/php7.2/etc/php-fpm.conf -t
 
#启动php-fpm
/usr/local/php7.2/sbin/php-fpm
/usr/local/php7.2/sbin/php-fpm -c /usr/local/php7/etc/php.ini -y /usr/local/php7.2/etc/php-fpm.conf
 
#关闭php-fpm
kill -INT `cat /usr/local/php7.2/var/run/php-fpm.pid`
 
#重启php-fpm
kill -USR2 `cat /usr/local/php7.2/var/run/php-fpm.pid`

 

以上是关于centos7.2 64位安装php7.2.12的主要内容,如果未能解决你的问题,请参考以下文章

centos7.2 64位 安装最新版 docker-ce-18.05.0

centos7.2 64位 hadoop2.7.3 安装 hawq 2.10 随笔啊随笔而已。

在Centos7.2(64位)下搭建Web服务器

Linux安装MySQL全过程

CentOS7.2 - 安装vnc,最小化安装vnc,命令行安装vnc,3级别安装vnc

CentOS7 安装 MySQL5.7