升级phpmyadmin版本,解决报错(phpmyadmin 5.2.0 / php 7.4.2)
一,报错信息:
Deprecation Notice in ./libraries/classes/Url.php#251 Array and string offset access syntax with curly braces is deprecated Backtrace ./vendor/composer/ClassLoader.php#444: include() ./vendor/composer/ClassLoader.php#322: Composer\Autoload\includeFile(
string '/var/www/web/html/phpmyadmin/vendor/composer/../../libraries/classes/Url.php') Composer\Autoload\ClassLoader->loadClass(string 'PhpMyAdmin\\Url') ./libraries/classes/Header.php#231: spl_autoload_call(string 'PhpMyAdmin\\Url') ./libraries/classes/Header.php#282: PhpMyAdmin\Header->getJsParams() ./libraries/classes/Header.php#214: PhpMyAdmin\Header->getJsParamsCode() ./libraries/classes/Header.php#142: PhpMyAdmin\Header->_addDefaultScripts() ./libraries/classes/Response.php#100: PhpMyAdmin\Header->__construct() ./libraries/classes/Response.php#134: PhpMyAdmin\Response->__construct() ./libraries/common.inc.php#430: PhpMyAdmin\Response::getInstance() ./prefs_manage.php#23: require_once(./libraries/common.inc.php)
每个页面都弹,可以忽略,但很麻烦,如图:
说明:刘宏缔的架构森林是一个专注架构的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/06/03/sheng-ji-phpmyadmin-ban-ben-jie-jue-bao-cuo-phpmyadmin-5-2/
对应的源码可以访问这里获取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,找出问题原因:
1,查看本地安装的php版本:
[lhdop@blog ~]$ /usr/local/soft/php7/bin/php -v PHP 7.4.2 (cli) (built: Apr 20 2022 16:49:58) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies
可以看到版本是 7.4.2
2,查看当前的phpmyadmin的版本:
可以看到当前版本是 4.9.0.1
3,打开phpmyadmin的下载页面,
https://www.phpmyadmin.net/downloads/
如图:
我们可以选择升级到5.2.0或 4.9.10,
这两个稳定版本均支持我们当前php环境
三,安装5.2.0版本
1,下载:
[lhdop@blog source]$ wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip
2,解压:
[root@blog source]# unzip phpMyAdmin-5.2.0-all-languages.zip
3,移动到document root目录下:
[root@blog source]# mv phpMyAdmin-5.2.0-all-languages /var/www/web/html/phpmyadmin
4,生成配置文件
[root@blog phpmyadmin]# cp config.sample.inc.php config.inc.php
5,修改内容:把host改为 127.0.0.1
如下:
//$cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['host'] = '127.0.0.1';
四,查看效果:
已没有报错信息