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

查看:35
本文介绍了在 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.

我该如何解决这个问题?

How do I fix this?

升级到最新版本的 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)."

我该如何解决这个问题?

How do I fix this?

推荐答案

在 Ubuntu 上手动更新 phpMyAdmin

在撰写本文时,Ubuntu 包管理器 (4.5.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中打开vendor_config.php
  2. 在第 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

<小时>

其他文档

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

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/.

重命名现有的 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天全站免登陆