PHP 7将mariadb与pam_auth连接会导致未知的身份验证方法

时间:2018-02-06 14:38:46

标签: php mysqli mariadb pam freeipa

我在ubuntu 16.04中运行mariadb 10.2。 mariadb将使用freeipa(ldap + kerberos)执行外部身份验证。我可以使用freeipa凭证将mariadb服务器与mariadb客户端连接起来。一切都像往常一样。 /etc/pam.d/mariadb如下:

auth required pam_unix.so 
account required pam_unix.so 
auth required pam_user_map.so

然而,当我使用php7 mysqli(命令行或web)连接时,它会返回:

(
    [affected_rows] => 
    [client_info] => 
    [client_version] => 50012
    [connect_errno] => 2054
    [connect_error] => The server requested authentication method unknown to the client
    [errno] => 
    [error] => 
    [error_list] => 
    [field_count] => 
    [host_info] => 
    [info] => 
    [insert_id] => 
    [server_info] => 
    [server_version] => 
    [stat] => 
    [sqlstate] => 
    [protocol_version] => 
    [thread_id] => 
    [warning_count] => 
)

从大量研究中我注意到php mysql驱动程序并不能很好地支持PAM身份验证。有在线资源http://www.sheeri.org/ldap-with-auth_pam-and-php/告诉我,有一种方法可以克服它,但它太粗糙了。有人可以告诉我如何使用libmariadbclient重建ubuntu吗?无论如何,我找不到/usr/bin/mysql_config。 感谢

1 个答案:

答案 0 :(得分:0)

我大大简化了解决方案,我为ubuntu创建了基本的bash脚本。它将使用默认的apache2 / php / percona服务器/客户端,仅覆盖mysqli.so,pdo_mysql.so。

https://gist.github.com/kstan79/367ef928e44523904fb36b67a92decdd