php 5.6.14 升级笔记

博主我用的是lnmp架构的amh4.2面板,如果自己安装的话,可能某些路径不一定一样,依葫芦画瓢应该也很简单~

目前最新版是5.6.14版本

首先wget一下php的源码压缩包

1
wget http://php.net/get/php-5.6.14.tar.bz2/from/a/mirror

然后

1
2
tar zxvf php-5.6.14.tar.gz
cd php-5.6.14

执行预编译

1
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-openssl --with-zlib --with-curl --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-mbstring --enable-zip --with-iconv=/usr/local/libiconv --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --without-pear --disable-fileinfo --enable-opcache

编译

1
2
make -j 3
make install

(-j的意思是使用多核cpu,这样能让编译速度加快,不过容易导致ssh掉线,因为我的cpu是4核的,所以我这里4-1=3,留出一个线程这样不容易死机)

好了,这样就已经升级完毕了

我用的是amh面板,所以还要加几句:

找到 /usr/local/php/etc/ 目录

修改如下文件

php-fpm.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
;include=etc/fpm/*.conf

[global]
pid = run/php-fpm.pid
log_level = error

[www]
listen = /tmp/php-cgi.sock
listen.owner = www
listen.group = www
listen.mode = 0660
user = www
group = www
pm = static
pm.max_children = 25
pm.start_servers = 17
pm.min_spare_servers = 3
pm.max_spare_servers = 25
request_terminate_timeout = 10s

rlimit_files = 51200

php-fpm-template.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
[global]
pid = run/php-fpm.pid
log_level = error

[example]
listen = /tmp/php-cgi.sock
listen.owner = www
listen.group = www
listen.mode = 0660
user = www
group = www
pm = dynamic
pm.max_children = 25
pm.start_servers = 17
pm.min_spare_servers = 3
pm.max_spare_servers = 25
request_terminate_timeout = 10s

rlimit_files = 51200
chroot = amysql.com

OK 完工~

Licensed under CC BY-NC-SA 4.0