大网数据广告活动
服务器运维问答

How to enable argon2 for php from centos software collections?

· 52CE 我爱测

I moved a nextcloud installation from one server to another. On the new server I want to use another version of PHP. The problem is that the passwords are hashed with the argon2 algorithm (in the tables oc_users and oc_share in t…

问题原文

原帖链接 · Lucas · CC BY-SA 4.0

I moved a nextcloud installation from one server to another. On the new server I want to use another version of PHP. The problem is that the passwords are hashed with the argon2 algorithm (in the tables oc_users and oc_share in the nextcloud database).

The problem is that the new version does not seem to support argon2 and I get "wrong password" messages when I try to log in with the user+password on the new server that I know to work on the old server.

On the old server I was using PHP 7.2 from the remi repository; on the new server I would like to use PHP 7.2 or 7.3 (do not care) from the centos-sclo-rh repository.

user@home $ ssh old
user@old $ php --version
PHP 7.2.29 (cli) (built: Mar 17 2020 11:36:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.29, Copyright (c) 1999-2018, by Zend Technologies
user@old $ php -r 'var_dump(PASSWORD_ARGON2I);'
int(2)
user@old $ exit
user@home $ ssh new
user@new $ scl enable rh-php72 -- php --version
PHP 7.2.24 (cli) (built: Nov  4 2019 10:23:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24, Copyright (c) 1999-2018, by Zend Technologies
user@new $ scl enable rh-php73 -- php --version
PHP 7.3.11 (cli) (built: Dec 10 2019 16:14:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
user@new $ scl enable rh-php72 -- php -r 'var_dump(PASSWORD_ARGON2ID);'

Warning: Use of undefined constant PASSWORD_ARGON2ID - assumed 'PASSWORD_ARGON2ID' (this will throw an Error in a future version of PHP) in Command line code on line 1
string(17) "PASSWORD_ARGON2ID"
user@new $ scl enable rh-php73 -- php -r 'var_dump(PASSWORD_ARGON2ID);'
PHP Warning:  Use of undefined constant PASSWORD_ARGON2ID - assumed 'PASSWORD_ARGON2ID' (this will throw an Error in a future version of PHP) in Command line code on line 1
string(17) "PASSWORD_ARGON2ID"

I also tried to install the sclo-php7{2,3}-php-sodium and libsodium because I found this: https://stackoverflow.com/a/59392421/4102092 but it did not help.

Finally the question: How can I use the PHP packages from the software collection repository and have argon2 support?

已采纳解答

原帖链接 · Remi Collet · CC BY-SA 4.0

Finally the question: How can I use the PHP packages from the software collection repository and have argon2 support?

You can't.

The sodium extension provides the argon2 password hash algorithm only in PHP >= 7.4, not in previous versions.

In 7.2 / 7.3, argon2 is part of the "standard" extension and is disabled in RH build as libargon2 is not available in RHEL / CentOS

On the old server I was using PHP 7.2 from the remi repository;

So this is the only solution for now.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-04-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。