你好,我想在自己的家中部署一个Intranet Web服务器,所以我在机器上安装了centOS,以及apache,php7.2和mysql。但是,我的php应用程序依赖libsodium进行数据加密,因此我先运行sudo yum install php-pecl-libsodium
,然后运行sudo pecl install libsodium
安装libsodium,然后在php.ini文件的末尾添加了extension=libsodium.so
自从我的phpinfo()
如下以来,它似乎一直起作用:
但是,当我尝试加载我的应用程序时,会发生此错误:
Warning: Use of undefined constant SODIUM_CRYPTO_SECRETBOX_KEYBYTES - assumed 'SODIUM_CRYPTO_SECRETBOX_KEYBYTES' (this will throw an Error in a future version of PHP) in /var/www/html/stm_asc/controller/database/MySQL_DataMapper.php on line 38
Fatal error: Uncaught TypeError: random_bytes() expects parameter 1 to be integer, string given in /var/www/html/stm_asc/controller/database/MySQL_DataMapper.php:38 Stack trace: #0 /var/www/html/stm_asc/controller/database/MySQL_DataMapper.php(38): random_bytes('SODIUM_CRYPTO_S...') #1 /var/www/html/stm_asc/controller/database/MySQL_DataMapper.php(56): asc\MySQL_DataMapper->__construct() #2 /var/www/html/stm_asc/views/login.php(11): asc\MySQL_DataMapper::getInstance() #3 {main} thrown in /var/www/html/stm_asc/controller/database/MySQL_DataMapper.php on line 38
第38行是MySQL_DataMapper.php:
因此,似乎宏SODIUM_CRYPTO_SECRETBOX_KEYBYTES
尚未加载,我知道此代码有效,因为它可以在我开发系统的机器上运行,并且记录为here。因此,对于这个新系统来说,这是某种配置问题,也许我正在丢失另一个我不记得的库?谢谢。