0

Issue - HTTP ERROR 500 for phpMyAdmin.
Apache error log

[Wed Aug 19 02:52:11.063688 2020] [:error] [pid 94653] [client ::1:56202] PHP Warning:  Unsupported declare 'strict_types' in /usr/share/php/PhpMyAdmin/MoTranslator/Loader.php on line 23
[Wed Aug 19 02:52:11.063864 2020] [:error] [pid 94653] [client ::1:56202] PHP Parse error:  syntax error, unexpected '?' in /usr/share/php/PhpMyAdmin/MoTranslator/Loader.php on line 116

phpMyAdmin is completely working fine when switched to php7.4. This issue happens only on php5.6

Setup - Ubuntu 20.04, php5.6, Apache/2.4.41, phpMyAdmin-4.9.5deb2, mysql-8.0.21 php -m (output)

[PHP Modules]
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imagick
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

I have removed the phpmyadmin from the distro and installed in through zip. And i am getting the following error.

mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client

I found the issue is that is with authentication method and changed the "caching_sha2_password" to "mysql_native_password" but still i am getting the above error.

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
+------------------+------------------------------------------------------------------------+-----------------------+-----------+
| user             | authentication_string                                                  | plugin                | host      |
+------------------+------------------------------------------------------------------------+-----------------------+-----------+
| debian-sys-maint | $A$005$@0IC@&1C
                                    O:Xf94qofd9PGZM4cSAB0xP0ZsNz7GUaX8UuPiAYIj5M0 | caching_sha2_password | localhost |
| mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
| mysql.session    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
| mysql.sys        | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
| phpmyadmin       | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19                              | mysql_native_password | localhost |
| root             | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19                              | mysql_native_password | localhost |
| surendhar        | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19                              | mysql_native_password | localhost |
+------------------+------------------------------------------------------------------------+-----------------------+-----------+
7 rows in set (0.00 sec)
0

In 20.04 phpmyadmin package is slightly messed up if you speak about using it with php5.6. It provides PMA4.9.5 which is php5.5+ compatible yet it depends on php-phpmyadmin-motranslator >= 5.0 which is php7.1+ compatible. The fatal error you see in the log is because of null coalescing operator ?? used in the code which is php7 feature.

PMA is not something you'd heavily depend on distro packaging. Just download 4.9.5 zip from github, extract it somewhere under your webroot and it should just work.

| improve this answer | |
  • afer installing from the zip i getting this error. mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password] mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client – surendhar153 Aug 19 at 7:56
  • It is because you use mysql8. Check this out stackoverflow.com/questions/49948350/phpmyadmin-on-mysql-8-0 – Zonmi Aug 19 at 8:53
0

The issue - ubuntu 20.04 uses mysql v8 with uses caching_sha2_password. Everything works fine php7.4. But when you use php5.6 you get two errors

  1. Server sent charset unknown to the client
  2. The server requested authentication method unknown to the client

To fix this issue we need to add below code to the /etc/mysql/my.cnf

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
default-authentication-plugin=mysql_native_password

You also need to update the user authentication method by the following code in mysql

alter user 'username'@'localhost' identified with mysql_native_password by 'password';
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.