教你編譯PHP7 (nginx+mysql+php7)

操做系統: CentOS Linux, 6.5 64位
服務器: 阿里雲
空的操做系統,咱們從0開始.
在開始前,請確保你的Linux已聯網,已聯網,已聯網!php

# 安裝編譯工具: yum install gcc automake autoconf libtool gcc-c++ # 安裝基礎庫 yum install gd zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel 
# 安裝mysql yum install mysql mysql-server 
# 下載pcre 正則庫 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2 tar jxf pcre-8.37.tar.bz2 
#編譯nginx cd /usr/local/src wget http://nginx.org/download/nginx-1.8.0.tar.gz tar zxf nginx-1.8.0.tar.gz cd nginx-1.8.0 ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/src/pcre-8.37 make && make install 
# 編譯PHP cd /usr/local/src wget http://cn2.php.net/get/php-7.0.0.tar.bz2/from/this/mirror mv mirror php-7.0.0.tar.bz2 tar jxf php-7.0.0.tar.bz2 cd php-7.0.0 ./configure --prefix=/usr/local/php \ --with-gd \ --with-freetype-dir \ --enable-gd-native-ttf \ --enable-mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-openssl \ --with-mcrypt \ --enable-mbstring \ --enable-zip \ --enable-fpm make && make install # 複製配置文件 cp /usr/local/src/php-7.0.0/php.ini-development /usr/local/php/lib/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 
# 整合nginx+php location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name; include fastcgi_params; } 
# 啓動php 和nginx /usr/local/php/sbin/php-fpm /usr/local/nginx/sbin/nginx 

寫測試PHP頁面html

<?php # /usr/local/nginx/html/a.php phpinfo(); 

打開瀏覽器: http://xxxxxx/a.php
mysql

相關文章
相關標籤/搜索