Rumah > pembangunan bahagian belakang > tutorial php > 教你编译PHP7 (nginx+mysql+php7)

教你编译PHP7 (nginx+mysql+php7)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Lepaskan: 2016-06-20 12:30:23
asal
867 orang telah melayarinya

 

操作系统: CentOS Linux, 6.5 64位
服务器: 阿里云
空的操作系统,我们从0开始.
在开始前,请确保你的Linux已联网,已联网,已联网!

# 安装编译工具: 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
Salin selepas log masuk
# 安装mysql yum install mysql mysql-server
Salin selepas log masuk
# 下载pcre 正则库 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2tar jxf pcre-8.37.tar.bz2
Salin selepas log masuk
#编译nginx cd /usr/local/srcwget http://nginx.org/download/nginx-1.8.0.tar.gztar 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
Salin selepas log masuk
# 编译PHP cd /usr/local/srcwget http://cn2.php.net/get/php-7.0.0.tar.bz2/from/this/mirrormv mirror php-7.0.0.tar.bz2tar 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-fpmmake && make install # 复制配置文件 cp /usr/local/src/php-7.0.0/php.ini-development /usr/local/php/lib/php.inicp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confcp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
Salin selepas log masuk
# 整合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;}
Salin selepas log masuk
# 启动php 和nginx /usr/local/php/sbin/php-fpm/usr/local/nginx/sbin/nginx
Salin selepas log masuk

写测试PHP页面

<?php # /usr/local/nginx/html/a.php phpinfo();
Salin selepas log masuk

打开浏览器: http://xxxxxx/a.php

sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan