thinkphp6: 从6.0.9升级(php 8.0.14)到 6.0.10lts版本(php 8.1.1)
一,切换php版本:从8.0.14到8.1.1
1,查看当前的php版本root@lhdpc:~# php --version PHP 8.0.14 (cli) (built: Dec 23 2021 11:52:42) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.14, Copyright (c) Zend Technologies with Zend OPcache v8.0.14, Copyright (c), by Zend Technologies2,切换: 把当前的php8备份为php80
root@lhdpc:/usr/local/soft# mv php8 php80
把之前安装的php81切换到php8
root@lhdpc:/usr/local/soft# mv php81 php8
3,查看php的版本:
root@lhdpc:/usr/local/soft# php --version PHP 8.1.1 (cli) (built: Dec 20 2021 16:12:16) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.1, Copyright (c) Zend Technologies with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies
可见已切换成功
4,重启php-fpm服务 重启root@lhdpc:/usr/local/soft# systemctl restart php-fpm.service查看服务状态
root@lhdpc:/usr/local/soft# systemctl status php-fpm.service ● php-fpm.service - The PHP FastCGI Process Manager Loaded: loaded (/etc/systemd/system/php-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-12-31 14:10:20 CST; 2s ago Main PID: 2990 (php-fpm) Tasks: 3 (limit: 4588) Memory: 18.6M CPU: 336ms CGroup: /system.slice/php-fpm.service ├─2990 php-fpm: master process (/usr/local/soft/php8/etc/php-fpm.conf) ├─2992 php-fpm: pool www └─2993 php-fpm: pool www 12月 31 14:10:20 lhdpc systemd[1]: Started The PHP FastCGI Process Manager.5,通过phpinfo查看切换效果:
说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest
对应的源码可以访问这里获取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,升级thinkphp6的版本:
切换到项目所在目录: 1,查看原来的版本:root@lhdpc:~# cd /data/php/admapi/ root@lhdpc:/data/php/admapi# php think version v6.0.92,升级命令:
liuhongdi@lhdpc:/data/php/admapi$ composer update如图: 说明:不能只升级framework, 会报错 3,查看升级后的版本:
liuhongdi@lhdpc:/data/php/admapi$ php think version v6.0.10LTS4,查看效果: 访问页面查看是否正常工作:
三,php的安装和创建thinkphp项目的文档,请参见:
1,安装php8.1.1https://www.cnblogs.com/architectforest/p/15714248.html2,创建thinkphp6项目:
https://www.cnblogs.com/architectforest/p/15725405.html