在Ubuntu 16上升级php7.2后phpMyAdmin错误(计数,河豚等) [英] phpMyAdmin errors (count, blowfish, etc.) after php7.2 upgrade on Ubuntu 16

查看:597
本文介绍了在Ubuntu 16上升级php7.2后phpMyAdmin错误(计数,河豚等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu 16.04 LTS上升级到php7.2后,当我查看表时phpMyAdmin显示烦人的弹出警告:

After upgrading to php7.2 on Ubuntu 16.04 LTS, phpMyAdmin shows annoying popup warnings when I view tables:

在服务器上检测到一些错误!请查看此窗口的底部.全部忽略.忽略."

"Some errors have been detected on the server! Please look at the bottom of this window. Ignore All. Ignore."

在窗口底部:

./libraries/sql.lib.php#601

"Warning in ./libraries/sql.lib.php#601

"警告

count():参数必须是实现Countable的数组或对象"

count(): Parameter must be an array or an object that implements Countable"

...,后面是长长的回溯列表.

... followed by a long backtrace list.

此问题在各种phpMyAdmin 4.x版本(包括4.5.4及以下版本)上发生.

This problem occurs on various phpMyAdmin 4.x versions including and below 4.5.4.

我该如何解决?

升级到最新版本的phpMyAdmin(4.7.9)之后,我现在在每个页面的底部显示一个新错误:

After upgrading to the newest version of phpMyAdmin (4.7.9), I now get a new error that shows up at the bottom of every page:

配置文件现在需要一个秘密密码(blowfish_secret)."

"The configuration file now needs a secret passphrase (blowfish_secret)."

我该如何解决?

推荐答案

在Ubuntu上手动更新phpMyAdmin

撰写本文时,Ubuntu 程序包管理器(4.5)中提供了phpMyAdmin版本. .4)不完全支持php7.2,这会导致烦人的count()警告. 解决方案是更新到最新的phpMyAdmin版本,在撰写本文时为4.7.9.

Manually update phpMyAdmin on Ubuntu

As of writing this, the phpMyAdmin version available in the Ubuntu package manager (4.5.4) does not fully support php7.2, which leads to the annoying count() warning. The solution is to update to the latest phpMyAdmin version, which is 4.7.9 at the time of writing.

Ubuntu软件包在后面.有一个 phpMyAdmin PPA ,但它也落后于此:

The Ubuntu package is behind. There is a phpMyAdmin PPA, but it too is behind:

注意:由于我很难找到时间将其更新到4.7系列,因此该存储库目前有些滞后."

"Note: This repository is currently a bit behind as I struggle to find time to update it to 4.7 series."

幸运的是,我们可以从旧版本手动升级.

Fortunately, we can manually upgrade from the older version.

基本步骤是:

  1. 制作当前安装的备份副本
  2. 下载并解压缩最新版本的phpMyAdmin
  3. 将vendor_config.php文件修改为适用于Ubuntu的适当目录
  4. 添加更长的随机字符串以解决河豚错误消息并允许正确的Cookie验证

这些终端命令应该完成工作(如果适用,请使用sudo):

These terminal commands should get the job done (use sudo if applicable):

mv /usr/share/phpmyadmin /usr/share/phpmyadmin_old
mkdir /usr/share/phpmyadmin
mkdir /var/downloads
cd /var/downloads
wget https://files.phpmyadmin.net/phpMyAdmin/4.7.9/phpMyAdmin-4.7.9-all-languages.tar.gz
tar -xf phpMyAdmin-4.7.9-all-languages.tar.gz -C /usr/share/phpmyadmin --strip-components=1

(可选)用您选择的最新版本或首选格式替换wget行.访问 https://www.phpmyadmin.net/downloads/.

(Optional) Replace the wget line with the latest version or preferred format of your choice. Visit https://www.phpmyadmin.net/downloads/.

这时,当您使用phpMyAdmin 时,可能会遇到一条河豚错误.要解决此问题,您应该更新特定的配置文件:

At this point, you will probably get a blowfish error when you use phpMyAdmin. To resolve this, you should update a specific configuration file:

  1. /usr/share/phpmyadmin/libraries/vendor_config.php
  2. 中打开vendor_config.php
  3. 在第38行或附近,将define('CONFIG_DIR', '');替换为define('CONFIG_DIR', '/etc/phpmyadmin/');并保存文件.
  1. Open vendor_config.php in /usr/share/phpmyadmin/libraries/vendor_config.php
  2. On or around line 38, replace define('CONFIG_DIR', ''); with define('CONFIG_DIR', '/etc/phpmyadmin/'); and save the file.

完成后,vendor_config.php的第33-38行应类似于:

When you are done, lines 33-38 of vendor_config.php should look something like:

/**
 * Directory where configuration files are stored.
 * It is not used directly in code, just a convenient
 * define used further in this file.
 */
define('CONFIG_DIR', '/etc/phpmyadmin/');

在这一点上,phpMyAdmin可以正常工作, ,但是您可能需要在blowfish_secret配置字符串中添加额外的长度 .

At this point, phpMyAdmin may work without errors, but you might need to add additional length to the blowfish_secret configuration string.

  1. 打开文件/var/lib/phpmyadmin/blowfish_secret.inc.php.

您应该看到:

<?php
$cfg['blowfish_secret'] = 'Something Short';

  1. $cfg['blowfish_secret']字符串添加额外的随机性,至少40个字符甚至更长的字符会更好(我使用的字符串只要100个字符).
  1. Add additional randomness to the $cfg['blowfish_secret'] string, at least 40 characters and even longer might be better (I use a string as long as 100 characters).

例如(不使用此示例):

For example (don't use this, just an example):

$cfg['blowfish_secret'] = 'A much longer random string 7NfSjYezwmwGCfGDuDO7uWn4ESw2sCFCym1RatPjGCfGCym1RatPjGCfG';

  1. 保存文件.

这时,刷新phpMyAdmin(在您的浏览器中)并再次登录 .现在一切都应该正常工作.

At this point, refresh phpMyAdmin (in your browser) and login again. Everything should work properly now.

如果需要,您可以使用以下方法删除旧的phpMyAdmin版本的备份副本:

If desired, you may remove the backup copy of the old phpMyAdmin version with:

rm -rfv /usr/share/phpmyadmin_old


其他文档

作为参考,以下摘录自有关手动更新到最新版本(这不是Ubuntu特定的 )的官方phpMyAdmin文档:

For reference, the following are excerpts from the official phpMyAdmin documentation about manually updating to the latest version (this is not Ubuntu specific):

警告

请不要从现有的安装中提取新版本 phpMyAdmin,始终首先删除旧文件,仅保留 配置.

Never extract the new version over an existing installation of phpMyAdmin, always first remove the old files keeping just the configuration.

这样,您将不会在代码中留下旧的不再起作用的代码 目录,它可能具有严重的安全隐患或可能导致 各种破损.

This way you will not leave old no longer working code in the directory, which can have severe security implications or can cause various breakages.

并且:

完整的升级可以通过几个简单的步骤完成:

The complete upgrade can be performed in few simple steps:

  1. 从以下位置下载最新版本的phpMyAdmin https://www.phpmyadmin.net/downloads/.

  1. Download the latest phpMyAdmin version from https://www.phpmyadmin.net/downloads/.

重命名现有的phpMyAdmin文件夹(例如重命名为phpmyadmin-old).

Rename existing phpMyAdmin folder (for example to phpmyadmin-old).

将刚下载的phpMyAdmin解压缩到所需位置(例如phpmyadmin).

Unpack freshly donwloaded phpMyAdmin to desired location (for example phpmyadmin).

将config.inc.php`从旧位置(phpmyadmin-old)复制到新位置(phpmyadmin).

Copy config.inc.php` from old location (phpmyadmin-old) to new one (phpmyadmin).

测试一切正常.

删除以前版本(phpmyadmin-old)的备份.

Remove backup of previous version (phpmyadmin-old).

这篇关于在Ubuntu 16上升级php7.2后phpMyAdmin错误(计数,河豚等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆