Search code examples
phpamazon-ec2serverphp-7libsodium

Library failure when installing Libsodium (Amazon EC2)


I can't figure out how to get Libsodium up and running on my EC2 instance.

When attempting to check if the installation was successful with:

php7 --info | grep sodium

I get the following warning:

PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) 'sodium.so' in Unknown on line 0

Here's what I've tried so far:

  • Installing Libsodium using pecl7 install libsodium.
  • Installing Libsodium using the latest tar.gz
  • Reinstalled PHP7 entirely (with apache 2.4)

This particular warning keeps popping up and my sodium functions are still unavailable.

Does anyone have any experience with installing Libsodium on PHP 7(+) on Amazon EC2 instances or do I have to wait for 7.2 to be stable and available?

Edit:

For anyone reading this after this question has been answered: This was a bug in the package manager (https://github.com/jedisct1/libsodium-php/issues/156) the matter has been resolved, reinstalling with pecl7 install libsodium fixed the issues.


Solution

  • Same on alpine and PHP 7.1... I am installing it via PECL.

    There is a bug report about it: https://github.com/jedisct1/libsodium-php/issues/156

    You can overcome this issue by forcing to use 2.0.8 until the issue gets fixed: pecl install -f libsodium-2.0.8