Marcin Nabiałek
Marcin Nabiałek

Reputation: 111859

Using libsodium in PHP 7.2

In PHP 7.2 libsodium should be part of PHP core. Is any entry in php.ini file required to make it work or maybe it should work out of the box?

I'm trying with PHP Version 7.2.0beta2 and functions like sodium_version_string() or sodium_compare are unknown. I'm using PHP docker box (7.2-rc-fpm)

Just in case - I haven't installed any PECL extension because as far as I understand it shouldn't be necessary.

Upvotes: 1

Views: 3129

Answers (1)

Frank Denis
Frank Denis

Reputation: 1501

In order for this extension to be built, the library has to be present, as long as the development headers.

In addition, the --with-sodium option has to be given to the ./configure script before compiling PHP.

If you don't want to recompile PHP, you can install the PECL version, which offers the exact same API (I usually update the PECL version first, and then port the changes to the PHP source code).

Upvotes: 3

Related Questions