PHP 的 configure --help 和手册,有时候惜字如金,让人困惑甚至抓狂,只能通过大量测试才能靠经验得出有用的结论。
这两个编译参数在 configure --help 中描述如下。- --with-openssl-argon2 OPENSSL: Enable argon2 password hashing
- --with-password-argon2 Include Argon2 support in password_*
复制代码 正常人肯定看不懂,不会知道这二者有什么关系。PHP 手册又有如下文字。
- To enable Argon2 password hashing, PHP must be built either with libargon2 support using the --with-password-argon2 configure option or, starting from PHP 8.4.0, with OpenSSL using --with-openssl and --with-openssl-argon2.
复制代码 好吧,看到这段文字,终于知道 --with-openssl-argon2 和 --with-password-argon2 是 Argon2 的两种实现,二选一就行。
然而天坑随之就来了,有很多扩展依赖于 openssl,而且 PHP 有 php php-cgi phpdbg 等诸多程序,将扩展编译成动态链接库可以节省不少磁盘空间,静态编译扩展会让每一个程序都带一份扩展的副本,导致 PHP 整体变得臃肿。但是 --with-openssl-argon2 要求静态编译 openssl,也就是说 --with-openssl 不能写成 --with-openssl=shared,--with-openssl-argon2 更不能写成 --with-openssl-argon2=shared,否则 --with-openssl-argon2 根本不会生效。而如果将 openssl 编译成了静态扩展,其他依赖它的扩展又编译成动态扩展的话,会导致更多的混乱。
所以,结论是,使用 --with-openssl-argon2 看起来可以不再依赖于 --with-password-argon2 背后的 libargon2,直接拿很多其他扩展都要使用的 openssl 来打底,而实际上它反而增加了麻烦,还不如就用 libargon2。 |
|