I need to encrypt passwords and some other data in my PHP(5.5.9) application on Ubuntu (14.04) server. I read about libsodium and found it a good fit for the applications requirements. I followed all the instructions given in the only tutorial available for libsoidum.
- sudo add-apt-repository ppa:chris-lea/libsodium - Done, no errors
- sudo apt-get update && sudo apt-get install libsodium-dev - Done, no errors
- pecl install libsodium - Done, no errors
- added extension=libsodium.so to php.ini and restarted apache.
When I check phpinfo() page I am able to see the entry for libsodium as follows:
libsodium support enabled
libsodium compiled version 1.0.6
libsodium headers version 1.0.3
libsodium library version 1.0.3
However, when I try to run the basic example given in the above tutorial which is:
<?php var_dump([ \Sodium\library_version_major(),\\Sodium\library_version_minor(),\Sodium\version_string() ]);?>
I get an error saying "Call to undefined function Sodium\library_version_major()".
This is really baffling me as the extension is identified correctly by phpinfo() page.
Can anyone please help me in understanding if I am missing something or doing wrong that I am not able to use libsodium with php. Any help is greatly appreciated.
Thank you.