CentOS6.5 64位编译PHP7 (nginx+mysql+php7)

  1. # 安装编译工具:
  2. yum install gcc automake autoconf libtool gcc-c++
  3.  
  4. # 安装基础库
  5. yum install gd zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel
  1. # 安装mysql
  2. yum install mysql mysql-server
  1. # 下载pcre 正则库
  2. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2
  3. tar jxf pcre-8.37.tar.bz2
  1.  
  2. #编译nginx
  3. cd /usr/local/src
  4.  
  5. wget http://nginx.org/download/nginx-1.8.0.tar.gz
  6. tar zxf nginx-1.8.0.tar.gz
  7.  
  8. cd nginx-1.8.0
  9. ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/src/pcre-8.37
  10. make && make install
  1. # 编译PHP
  2. cd /usr/local/src
  3. wget http://cn2.php.net/get/php-7.0.0.tar.bz2/from/this/mirror
  4. mv mirror php-7.0.0.tar.bz2
  5. tar jxf php-7.0.0.tar.bz2
  6.  
  7. cd php-7.0.0
  8.  
  9. ./configure --prefix=/usr/local/php \
  10. --with-gd \
  11. --with-freetype-dir \
  12. --enable-gd-native-ttf \
  13. --enable-mysqlnd \
  14. --with-pdo-mysql=mysqlnd \
  15. --with-openssl \
  16. --with-mcrypt \
  17. --enable-mbstring \
  18. --enable-zip \
  19. --enable-fpm
  20.  
  21. make && make install
  22.  
  23. # 复制配置文件
  24. cp /usr/local/src/php-7.0.0/php.ini-development /usr/local/php/lib/php.ini
  25. cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
  26. cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
  1. # 整合nginx+php
  2. location ~ \.php$ {
  3.     root           html;
  4.     fastcgi_pass   127.0.0.1:9000;
  5.     fastcgi_index  index.php;
  6.     fastcgi_param  SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
  7.     include        fastcgi_params;
  8. }
  1. # 启动php 和nginx
  2. /usr/local/php/sbin/php-fpm
  3. /usr/local/nginx/sbin/nginx
  1. #写测试PHP页面
  2. <?php
  3. # /usr/local/nginx/html/PHP7.php
  4. phpinfo();

打开浏览器测试: http://www.xxx.xxx/PHP7.php

php7


发布日期:

所属分类: 手游单机 标签:    


没有相关文章!