安装php7.2
lnmp 环境单独再配置php新版本:
sudo ./install.sh mphp ----- 我本次的环境,原有是用lnmp1.3 安装的
可以直接下载lnmp1.5的包,从里面单独安装php7.2,安装的过程中,原有的lnmp环境会被破坏掉;
默认没有安装redis,从lnmp1.5 的 ./addons.sh 安装redis,安装的时候会提示所选择的php版本,
安装好了会自动重启php-fpm
nginx 配置
server{
listen 80;
server_name local.txsq.com;
index index.html index.htm admin.php index.php;
root /home/wwwroot/default/txsq/tortoise/Public;
#error_page 404 /404.html;
include enable-php7.2-pathinfo.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*.(js|css)?$
{
expires 12h;
}
if (!-e $request_filename) {
# rewrite ^/(.*) /index.php/$1 last;
}
location ~ /.
{
deny all;
}
access_log /home/wwwlogs/access-txsq.log;
}
enable-php7.2-pathinfo.conf 文件配置展示
location ~ [^/].php(/|$)
{
# try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi7.2.sock;
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;
}
查看所在进程的php-fpm,配置是否正确
/usr/local/php7.3/sbin$ php-fpm -t
[26-Jan-2021 13:48:42] ERROR: failed to open error_log (/usr/local/php/var/log/php-fpm.log): Permission denied (13)
[26-Jan-2021 13:48:42] ERROR: failed to post process the configuration
[26-Jan-2021 13:48:42] ERROR: FPM initialization failed
重启php-fpm
查看php-fpm进程数:
ps aux | grep -c php-fpm
[root@ssy106c14c190c69 etc]# ps -ef | grep php-fpm --- 查看php-fpm 进程数量
root 10436 1 3 21:33 ? 00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
www 10437 10436 0 21:33 ? 00:00:00 php-fpm: pool www
www 10438 10436 0 21:33 ? 00:00:00 php-fpm: pool www
www 10439 10436 0 21:33 ? 00:00:00 php-fpm: pool www
php-fpm 重启:
sudo kill -USR2 10436
相信坚持的力量,日复一日的习惯.