3、编译PHP:
| cd /usr/local/src/php-7.0.0RC5 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-fpm-user=www --with-fpm-group=www --enable-fpm --disable-fileinfo --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-gettext --enable-zip --enable-soap --disable-debug make #时间可能较长,我的vps.to VPS花费大约十五分钟 make install |
4、添加环境变量:
| vim /etc/environment #在PATH变量的最后加入: :/usr/local/php/bin #保存退出 source /etc/environment |
5、测试:php -v,输出PHP版本就表示安装成功了。
五、修改nginx、MariaDB、PHP配置文件
1、修改nginx配置文件,建立虚拟主机配置文件夹:
| mkdir /usr/local/nginx/conf/vhost |
2、编辑nginx.conf,引入所有虚拟主机配置:
| vim /usr/local/nginx/conf/nginx.conf #在最后的}前一行加入 include vhost/*.conf; #文件头部 user www; work_process 1;#根据CPU核数设定 #保存退出 |
3、添加nginx服务,并测试nginx:
| wget https://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx -O /etc/init.d/nginx chmod +x /etc/init.d/nginx service nginx start |
4、如果出现Nginx服务器正在启动就表示成功了,最后执行以下代码开机启动:
| update-rc.d –f nginx defaults |
5、修改MariaDB配置文件,设置MariaDB字符集:
| cd /etc/my.cnf.d vim server.cnf #在[mysqld]段下加入character-set-server=utf8 #在[server]段上方输入[client]default-character-set=utf8 #保存退出service mysql restart |
6、修改PHP配置文件,复制默认php.ini文件:
| cd /usr/local/src/php-7.0.0RC5cp php.ini-production /usr/local/php/etc/php.ini |
7、关闭display_errors:
| vim /usr/local/php/etc/php.ini#定位到display_errors,设置:display_errors = Off#保存退出 |
8、修改php-fpm配置:
| cd /usr/local/php/etc cp php-fpm.conf.default php-fpm.conf #如果没有则建立该文件 cd php-fpm.d cp www.conf.default www.conf vim www.conf #修改如下项目: user = www group = www listen = /dev/shm/php-cgi.sock listen.owner = www listen.group = www listen.mode = 0660 #保存退出 |








