1

When making call to sodium_crypto_pwhash_str I get the following in my Apache error log file.

PHP Fatal error: Uncaught Error: Call to undefined function sodium_crypto_pwhash_str()

My php version, as noted is 7.3.17 running on an Amazon EC2 instance.

My php-info() does not return any relevant libsodium information other than module author info:

Sodium Frank Denis

Given the above author information references a module author am I supposed to enable the sodium module? If the answer is yes is it referenced in the php.ini file? Such as:

extension=sodium

or perhaps:

extension=libsodium

What am I missing here?

Am I not supposed to use the documented function sodium_crypto_pwhash_str?

Am I supposed to use some other method of accessing the desired functionality?

E.Bradford
  • 496
  • 3
  • 14
  • Best I can make out it needs to be compiled into PHP. And it looks like the Amazon EC2 Php V7.3 does not have it. You would think such a valuable functionality would be built-in.. – E.Bradford May 30 '20 at 22:08

1 Answers1

0

Yes normally it's included in PHP 7.2+ but when you use the AWS EC2 instances this is a bit minimalistic and not everything is included.

https://www.php.net/manual/de/sodium.installation.php

Here you can see that you have to enable it during the compiling with --with-sodium[=DIR]. So you can compile it on your own or you try another distro to get it from your package manager or you use another lib to make it work.

https://forums.aws.amazon.com/thread.jspa?threadID=293187

René Höhle
  • 24,401
  • 22
  • 66
  • 73