PHP - 在ubuntu 20.04中,php5.6,phpMyAdmin不工作

分享于 

5分钟阅读

ubuntu

  繁體

问题:

问题 - phpMyAdmin的HTTP 500错误,apache错误日志


[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在切换到php7.4时完全工作正常。这个问题仅在php5.6上发生


[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



我已经从发行版中删除了phpmyadmin,并通过zip安装,我得到以下错误。


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




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)




答案1:

在20.04中,如果您使用php5.,则phpmyadmin软件包会有些混乱。phpmyadmin提供了与php5.5 +兼容的PMA4.9.5,但取决于php-phpmyadmin-motranslator> = 5.0,与php7.1 +兼容。

只需从github下载4.9.5 zip,将其解压缩到您的webroot下的某个位置即可。


答案2:

问题-ubuntu 20.04使用mysql v8和caching_sha2_password。使用php7.4一切正常。但是当您使用php5.6时,会遇到两个错误

  • 服务器向客户端发送未知字符集
  • 服务器请求的客户端身份验证方法未知
  • 要解决这个问题,我们需要将以下代码添加到/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
    
    
    
    

    你还需要通过以下代码,更新mysql用户认证方法

    
    alter user 'username'@'localhost' identified with mysql_native_password by 'password';
    
    
    
    


  • PHP  Ubuntu  php5  Phpmyadmin