2

Hello I'm trying to deploy a intranet web server at my house, so I installed centOS on a machine, together with apache, php7.2 and mysql. However, my php application depends on libsodium for data encryption, so I ran sudo yum install php-pecl-libsodium followed by sudo pecl install libsodium to install libsodium, after that I added extension=libsodium.so to the end of php.ini file and it seemed to have worked since my phpinfo() is as follows:

print of phpinfo() that shows libsodium info

However when I try to load my application, this error occurs:

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

Here is MySQL_DataMapper.php on line 38:

enter image description here

So it seems like the macro SODIUM_CRYPTO_SECRETBOX_KEYBYTES is not loading, I know this code works because it works on the machine I developed the system in, and it is documented as such here. So it is some sort of configuration problem for this new system, maybe I am missing another library that I don't remember? Thank You.

Alexandre Krabbe
  • 727
  • 1
  • 13
  • 33

0 Answers0