码迷,mamicode.com
首页 > Web开发 > 详细

编译安装PHP7

时间:2017-09-18 15:00:35      阅读:297      评论:0      收藏:0      [点我收藏+]

标签:ash   0.11   jpeg   安装   names   app   ml2   index   sys   

CentOS6.6编译安装PHP7

  • 首先安装依赖包

yum install gcc gcc-c++ pcre* openssl* gd-devel* zlib-devel pcre-devel libxml2-devel curl-devel

  

        下载安装libmcrypt

        地址:http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/

        编译安装即可

tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install

        编辑  /etc/ld.so.conf  末行添加

/usr/local/lib

  

  • 下载PHP7

wget http://cn2.php.net/distributions/php-7.0.1.tar.gz
tar zxvf php-7.0.1.tar.gz
  • 编译安装PHP7

技术分享
./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --without-gdbm --disable-fileinfo
View Code
make && make install
  • 配置文件

cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf 
cp php.ini-production /usr/local/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
  • 启动

/etc/init.d/php-fpm start
  • nginx链接php

cat /etc/nginx/nginx.conf

技术分享
user  nginx;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  $remote_addr - $remote_user [$time_local] "$request" 
                     $status $body_bytes_sent "$http_referer" 
                      "$http_user_agent" "$http_x_forwarded_for";

   # access_log  logs/access.log  main;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 300m;
sendfile        on;
tcp_nopush     on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
keepalive_timeout  60;
tcp_nodelay on;
server_tokens off;
gzip  on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types       text/plain application/x-javascript text/css application/xml;
gzip_vary on;


    server {
        listen       80;
        server_name  www.qy.com;


        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;

       }

   }

include /etc/nginx/vhost/*.conf;

}
View Code

cat /etc/nginx/vhost/zabbix.conf 

技术分享
server
        {
                listen       80;
                server_name 192.168.80.11;
                index index.php index.html index.htm default.html default.htm default.php;
                root  /usr/local/nginx/html;

        location ~ \.php$ {
        root           /usr/local/nginx/html;
        fastcgi_pass   192.168.80.11:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/$fastcgi_script_name;
        include        fastcgi_params;
 }
                  



  
       location /status {
                stub_status on;
                access_log   off;
                }

       location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
              
 {     expires 30d;
                                     }
       location ~ .*\.(js|css)?$
 {
       expires 12h;
                                    }

       access_log off;
                                    }
View Code

 

编译安装PHP7

标签:ash   0.11   jpeg   安装   names   app   ml2   index   sys   

原文地址:http://www.cnblogs.com/hanwei999/p/7542641.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!