《教你编译PHP7 (nginx+mysql+php7)优就业》要点:
本文介绍了教你编译PHP7 (nginx+mysql+php7)优就业,希望对您有用。如果有疑问,可以联系我们。
PHP7正式版已经宣布,性能是PHP5.6的两倍!
PHP(http://www.ujiuye.com/zt/php/)的讲堂上,已经开始使用PHP7!
操作体系: CentOS Linux, 6.5 64位
服务器: 阿里云
空的操作系统,我们从0开端.
在开端前,请确保你的Linux已联网,已联网,已联网!
1 2 3 4 5 | # 安装编译工具: 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 |
1 2 | # 安装mysql yum install mysql mysql-server |
1 2 3 | # 下载pcre 正则库 wget ftp: //ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2 tar jxf pcre-8.37.tar.bz2 |
1 2 3 4 5 6 7 8 9 | #编译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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # 编译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 |
1 2 3 4 5 6 7 8 | # 整合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; } |
1 2 3 | # 启动php 和nginx /usr/local/php/sbin/php-fpm /usr/local/nginx/sbin/nginx |
写测试PHP页面
1 2 3 | <?php # /usr/local/nginx/html/a.php phpinfo();<br>?> |
打开阅读器: http://xxxxxx/a.php
更多PHP常识尽在优就业IT培训:www.ujiuye.com
欢迎参与《教你编译PHP7 (nginx+mysql+php7)优就业》讨论,分享您的想法,维易PHP学院为您提供专业教程。
转载请注明本页网址:
http://www.vephp.com/jiaocheng/7833.html