lnmp1.6正式版一键安装包php5+升级到php7+操作流程步骤及升级报错处理

管理员 发布于 3年前   613

一台centos7.6的测试机之前装的时候随便装了5.6后面需要测试laravel所以要升级到7.3+

进入到你的lnmp1.6安装包的根目录

[root@www ~]# ll
total 3760
-rw-------. 1 root  root     1454 Aug 22  2019 anaconda-ks.cfg
drwxr-xr-x. 7 root  root      251 Jun 19  2019 lnmp1.6
-rw-r--r--. 1 root  root   160228 Aug 18  2019 lnmp1.6.tar.gz
-rw-r--r--. 1 root  root  2696785 Aug 28  2019 lnmp-install.log
-rw-r--r--. 1 mysql wheel   22710 Apr 25  2018 package.xml
-rw-r--r--  1 root  root   955864 Jul  8 10:53 upgrade_lnmp_php20200708104353.log
[root@www ~]# cd lnmp1.6
[root@www lnmp1.6]# ll
total 100
-rwxr-xr-x. 1 root root  9671 May 26  2019 addons.sh
-rw-r--r--. 1 root root 13722 Dec 31  2018 ChangeLog
drwxr-xr-x. 4 root root  4096 Apr  1  2019 conf
drwxr-xr-x. 2 root root  4096 Mar 20  2019 include
drwxr-xr-x. 2 root root   161 Mar 13  2019 init.d
-rwxr-xr-x. 1 root root  5393 Jun 19  2019 install.sh
-rw-r--r--. 1 root root   209 Jul  3  2016 License
-rwxr-xr-x. 1 root root   375 Jan  4  2019 lnmp.conf
-rwxr-xr-x. 1 root root  5193 Mar 21  2019 pureftpd.sh
-rw-r--r--. 1 root root  7131 Jun  4  2019 README
drwxr-xr-x. 5 root root  4096 Jul  8 10:46 src
drwxr-xr-x. 2 root root   247 Apr  1  2017 tools
-rwxr-xr-x. 1 root root  6447 Dec  7  2018 uninstall.sh
-rwxr-xr-x. 1 root root 14178 Feb 28  2019 upgrade1.x-1.6.sh
-rwxr-xr-x. 1 root root  2777 Dec  7  2018 upgrade.sh

执行:   ./upgrade.sh php (会显示要你输入升级的php版本号,如7.3.11回车,再次回车确认即可开始升级)

然后就等结束提示升级成功完成就ok了 .......但是 

既然是升级就有可能会失败 

比如我这就遇到了一种,开始升级后直接很长时间停在这里 看

Warning! a PEAR user config file already exists from a previous PEAR installation at '/root/.pearrc'. You may probably want to remove it.
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/lnmp1.6/src/php-7.3.11/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers:           /usr/local/php/include/php/ext/pdo/
Copy new php configure file...
Modify php.ini......
config-set succeeded
config-set succeeded
All settings correct for using Composer
Downloading...

直接ctrl+z停止它

php-v看一下版本

[root@www ~]# php -v
PHP 7.3.11 (cli) (built: Jul  8 2020 10:51:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

这样就成功了 好那就重启服务lnmp restart

[root@www ~]# lnmp restart
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Stoping LNMP...
Stoping nginx... nginx is not running.
ERROR! MySQL server PID file could not be found!
/usr/bin/lnmp: line 41: /etc/init.d/php-fpm: No such file or directory
Starting LNMP...
Starting nginx...  done
Starting MySQL.. SUCCESS!
/usr/bin/lnmp: line 27: /etc/init.d/php-fpm: No such file or directory

有问题 提示:/etc/init.d/php-fpm 文件不存在 那就创建它咯

[root@www ~]# vi /etc/init.d/php-fpm
#我到另外一台php版本是7.3.11的服务器上复制过来配置信息

#! /bin/sh

### BEGIN INIT INFO
# Provides:          php-fpm
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO

prefix=/usr/local/php
exec_prefix=${prefix}

php_fpm_BIN=${exec_prefix}/sbin/php-fpm
php_fpm_CONF=${prefix}/etc/php-fpm.conf
php_fpm_PID=${prefix}/var/run/php-fpm.pid


php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"


wait_for_pid () {
try=0

while test $try -lt 35 ; do

case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;

'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac

echo -n .
try=`expr $try + 1`
sleep 1

done

}

case "$1" in
start)
echo -n "Starting php-fpm "

$php_fpm_BIN --daemonize $php_opts

if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi

wait_for_pid created $php_fpm_PID

if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;

stop)
echo -n "Gracefully shutting down php-fpm "

if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi

kill -QUIT `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then
echo " failed. Use force-quit"
exit 1
else
echo " done"
fi
;;

status)
if [ ! -r $php_fpm_PID ] ; then
echo "php-fpm is stopped"
exit 0
fi

PID=`cat $php_fpm_PID`
if ps -p $PID | grep -q $PID; then
echo "php-fpm (pid $PID) is running..."
else
echo "php-fpm dead but pid file exists"
fi
;;

force-quit)
echo -n "Terminating php-fpm "

if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi

kill -TERM `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;

restart)
$0 stop
$0 start
;;

reload)

echo -n "Reload service php-fpm "

if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi

kill -USR2 `cat $php_fpm_PID`

echo " done"
;;

configtest)
$php_fpm_BIN -t
;;

*)
echo "Usage: $0 {start|stop|force-quit|restart|reload|status|configtest}"
exit 1
;;

esac

继续重启服务: lnmp restart

[root@www ~]# lnmp restart
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Stoping LNMP...
Stoping nginx...  done
Shutting down MySQL. SUCCESS! 
/usr/bin/lnmp: line 41: /etc/init.d/php-fpm: Permission denied
Starting LNMP...
Starting nginx...  done
Starting MySQL.. SUCCESS! 
/usr/bin/lnmp: line 27: /etc/init.d/php-fpm: Permission denied

又有问题 无权限 直接给权限755

chmod 755 /etc/init.d/php-fpm

在一次重启服务:lnmp restart

[root@www ~]# lnmp restart
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Stoping LNMP...
Stoping nginx...  done
Shutting down MySQL. SUCCESS!
Gracefully shutting down php-fpm warning, no pid file found - php-fpm is not running ?
Starting LNMP...
Starting nginx...  done
Starting MySQL.. SUCCESS!
Starting php-fpm [08-Jul-2020 11:17:03] ERROR: failed to open configuration file '/usr/local/php/etc/php-fpm.conf': No such file or directory (2)
[08-Jul-2020 11:17:03] ERROR: failed to load configuration file '/usr/local/php/etc/php-fpm.conf'
[08-Jul-2020 11:17:03] ERROR: FPM initialization failed
failed

又有问题 提示/usr/local/php/etc/php-fpm.conf 文件不存在 继续创建它

[root@www ~]# vi /usr/local/php/etc/php-fpm.conf
#我到另外一台php版本是7.3.11的服务器上复制过来配置信息

[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice

[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 120
pm.start_servers = 30
pm.min_spare_servers = 30
pm.max_spare_servers = 120
pm.max_requests = 1024
pm.process_idle_timeout = 10s
request_terminate_timeout = 300
request_slowlog_timeout = 0
slowlog = var/log/slow.log

继续重启服务:lnmp restart

[root@www ~]# lnmp restart
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Stoping LNMP...
Stoping nginx...  done
Shutting down MySQL. SUCCESS!
Gracefully shutting down php-fpm warning, no pid file found - php-fpm is not running ?
Starting LNMP...
Starting nginx...  done
Starting MySQL.. SUCCESS!
Starting php-fpm  done

php没运行 忽略它 在重启服务一次:lnmp restart

[root@www ~]# lnmp restart
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Stoping LNMP...
Stoping nginx...  done
Shutting down MySQL. SUCCESS!
Gracefully shutting down php-fpm . done
Starting LNMP...
Starting nginx...  done
Starting MySQL.. SUCCESS!
Starting php-fpm  done
[root@www ~]#

ok了  希望对你有帮助

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

该博客于2020-12-7日,后端基于go语言的beego框架开发
前端页面使用Bootstrap可视化布局系统自动生成

是我仿的原来我的TP5框架写的博客,比较粗糙,底下是入口
侯体宗的博客

      订阅博客周刊

文章标签

友情链接

HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群
侯体宗的博客