E.Bradford
E.Bradford

Reputation: 813

PHP Version 7.3.17 on Amazon EC2 missing sodium?

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?

Upvotes: 1

Views: 1205

Answers (1)

René Höhle
René Höhle

Reputation: 27285

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

Upvotes: 0

Related Questions