下载7:php
$ cd $ mkdir php7test $ cd php7test $ wget http://cn2.php.net/get/php-7.0.7.tar.gz/from/this/mirror $ tar -zxvf php-7.0.7.tar.gz $ cd php-7.0.7
安装一些依赖:html
$ yum -y install libjpeg libpng freetype libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel curl-devel libxslt-devel lib2 lib2-devel
配置configuremysql
$ ./configure --prefix=/data/php7 --with-config-file-path=/data/php7/etc --with-config-file-scan-dir=/data/php7/etc/php.d --with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-fpm-user=xxxxxxxxxx --with-fpm-group=xxxxxxxxxx --with-gd --with-iconv --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --with-zlib --enable-bcmath --enable-sockets
而后:nginx
$ make $ make install
默认安装好以后,你会发现/data/php7/etc
下面没有php.ini文件,这个去哪里要呢?在php7的源码安装包都有。sql
进入源码安装包的目录segmentfault
$ cd $ cd php7test/php-7.0.7 $ ls
能够看到有两个php.ini-xxx
的文件api
$ cp php.ini* /data/php7/etc/ $ cp php.ini-production /data/php7/etc/php.ini
先配置config文件session
$ cd /data/php7/etc $ cp php-fpm.conf.default php-fpm.conf $ cp php-fpm.d/www.conf.default php-fpm.d/www.conf
在编译以前./configure的时候,咱们都已经肯定了一些配置,好比运行fpm的用户和用户组之类的,因此默认配置应该不会存在路径问题和权限问题。php7
搞定php-fpm的服务载入curl
咱们但愿使用service php-fpm start|stop|restart
这些操做来实现服务的重启,但没有像nginx那么复杂,php编译好以后,给咱们提供了一个php-fpm的程序,不须要我再编写分享了。这个文件放在php编译源码目录中:
$ cd $ cd php7test/php-7.0.7/sapi/fpm $ cp init.d.php-fpm /etc/init.d/php-fpm $ chmod +x /etc/init.d/php-fpm $ chkconfig --add php-fpm $ chkconfig php-fpm on
经过上面这个操做,咱们就能够使用sevice php-fpm start
来启用php-fpm了。用ps -ef | grep php-fpm
看看进程吧。
或者经过使用/data/php7/sbin/php-fpm
来启动php7.
Finish & Success
参考