JanE182098109

Member
Jun 28, 2016
7
1
3
Finland
cPanel Access Level
Root Administrator
Hi. I have a cPanel powered server CentOS 6.8 X86_64 standard WHM 56.0. (build 24) with PHP 5.6.20

After successfully installing Libsodium via
yum install libsodium

I tried to install PHP extension PECL Libsodium via WHM -> Module installers ->PECL

but no luck. I also tried this via ssh (pecl install libsodium), but ended up with same error.

Below is the output by WHM, errors bolded by me. Any ideas as what's wrong with this box and how to fix it?
Code:
Installing PHP Pecl "libsodium"
downloading libsodium-1.0.6.tgz ...
Starting to download libsodium-1.0.6.tgz (169,817 bytes)
.....................................done: 169,817 bytes
9 source files, building
running: phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
building in /root/tmp/pear/pear-build-rootr8RevY/libsodium-1.0.6
running: /root/tmp/pear/libsodium/configure --with-php-config=/usr/local/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20131226
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for libsodium support... yes, shared
checking for libsodium files in default path... found in /usr
checking for crypto_pwhash_scryptsalsa208sha256 in -lsodium... no
configure: error: wrong libsodium lib version or lib not found
ERROR: `/root/tmp/pear/libsodium/configure --with-php-config=/usr/local/bin/php-config' failed
The libsodium.so object is not in /usr/local/lib/php/extensions/no-debug-non-zts-20131226
Tidying /usr/local/lib/php.ini...
No changes
Tidying /usr/local/cpanel/3rdparty/php/54/etc/php.ini...
No changes
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello,

Verify the "libsodium-devel" package is installed on your system and then try installing the PECL module again:

Code:
yum install libsodium-devel
Thanks!
 

JanE182098109

Member
Jun 28, 2016
7
1
3
Finland
cPanel Access Level
Root Administrator
Hello. Thank you for your reply.

My apologies, I typed incorrectly on my opening post. I actually did do yum install libsodium-devel, which installs libsodium as dependency.
Verified and have these installed: libsodium-devel-0.4.5-3.el6.x86_64 and libsodium-0.4.5-3.el6.x86_64

I wonder is there a way to try to install a different version of libsodium or pecl libsodium?
PECL :: Package :: libsodium
Maybe this is some incompatibility issue?

One error (configure: error: wrong libsodium lib version or lib not found)

refers to situation I found here:
github.com/jedisct1/libsodium-php/blob/master/config.m4
(line 37)

Just a guess, I have no idea what's wrong.
 
Last edited by a moderator:

JanE182098109

Member
Jun 28, 2016
7
1
3
Finland
cPanel Access Level
Root Administrator
Update:

I tried this (found on: stackoverflow.com/questions/36705155/trouble-installing-libsodium-on-centos-6)
yum --enablerepo=remi install php-pecl-libsodium
Error getting repository data for remi, repository not found

I don't know if enabling remi repo can mess up with cPanel/server updates, so I have not enabled it.

@cPanelMichael, can I install remi safely so that I could try the command above? Or is there some other, perhaps more appropriate way of trying this?
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello,

You could try manually compiling the library before installing a custom YUM repo. The instructions on github.com/jedisct1/libsodium suggest running the following commands:

Code:
cd /usr/src
git clone https://github.com/jedisct1/libsodium
cd libsodium
./autogen.sh
Thank you.
 

JanE182098109

Member
Jun 28, 2016
7
1
3
Finland
cPanel Access Level
Root Administrator
Hi. Thank you, I appreciate it.

I already did that on another (non-production) server, but the extension does not load. This time the error was:
Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/libsodium.so' - /usr/lib64/php/modules/libsodium.so: undefined symbol: crypto_pwhash_memlimit_sensitive in Unknown on line 0

I think I might try compiling both libsodium(libsodium.org/) and the php-extension (github.com/jedisct1/libsodium) from source(s) with latest versions and see what happens.
 
Last edited by a moderator:

JanE182098109

Member
Jun 28, 2016
7
1
3
Finland
cPanel Access Level
Root Administrator
Did this work for you? If not, did you find another way to get it to work? I'm having the exact same errors you described.
I did not go that far. I gave up on libsodium, because I found another solution that met my needs for encryption. We only have one cPanel server, and it's a production server with customers on so I could not test things further. Sorry.

If you manage to get things working, please post your solution here.
 

yatesf

Member
Sep 28, 2013
9
2
53
cPanel Access Level
Root Administrator
If you manage to get things working, please post your solution here.
Code:
yum install libsodium-devel
In my case, the above yum command did not install all of the correct ".h" crypto include files that were needed in order for the PECL extension to pass it's initial checks for proper installation. To be more specific, the assignment of LIBSYMBOL=crypto_pwhash_scryptsalsa208sha256 (on github.com/jedisct1/libsodium-php/blob/master/config.m4 line 30 of this config.m4 file) causes a false evaluation later in a dependency check because the file "crypto_pwhash_scryptsalsa208sha256.h" didn't exist in my /usr/include/sodium/ directory.

So as my workaround, I installed the libsodium library manually from the latest available tarball instead (github.com/jedisct1/libsodium/releases v1.0.11). After that, all the latest ".h" crypto files were included in a /usr/local/include/sodium/ folder, thus causing the PECL extension installation check to pass. I was able to run the PECL extension installation successfully (I even ran my PECL extension installation from WHM via: Home » Software » Module Installers » PHP PECL Manage

I rebooted Apache, and I was good to go. Hope this might help others who have the same install problem on a cPanel server.
 
Last edited by a moderator:

JanE182098109

Member
Jun 28, 2016
7
1
3
Finland
cPanel Access Level
Root Administrator
Code:
yum install libsodium-devel
I rebooted Apache, and I was good to go. Hope this might help others who have the same install problem on a cPanel server.
Ok, good to hear that you managed to get it working. Libsodium is a great library and I could use it in several other projects.
We should have a development server with cPanel coming soon, so I am going to try this then.

Thank you very much for sharing!
 

yatesf

Member
Sep 28, 2013
9
2
53
cPanel Access Level
Root Administrator
Thank you very much for sharing!
refers to situation I found here:
github.com/jedisct1/libsodium-php/blob/master/config.m4
(line 37)
You're very welcome. I really have to thank you though, because if it had not been for the identification of line 37 in that config.m4 file (above), I would have never taken the time to further trace the installation issue that I was experiencing, and I would have given up on libsodium and implemented a much weaker KDF into my hashing & encryption designs. That was just enough of a great starting point for me to find the motivation to pursue further.
 
  • Like
Reactions: cPanelMichael

sneader

Well-Known Member
Aug 21, 2003
1,191
60
178
La Crosse, WI
cPanel Access Level
Root Administrator
I thought I'd chime in with the process I used to get libsodium installed, with php pecl. I also included how I offered this as an optional extension via PHP Selector in CloudLinux, in case this is useful...

First we have to install the Remi Repo:

Code:
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm  
rpm -Uvh remi-release-6*.rpm
Now we install libsodium using the Remi Repo:

Code:
yum --enablerepo=remi install libsodium-devel

Now we install libsodium PHP PECL via WHM:

WHM > Module Installers > PHP Pecl > libsodium > install
Disable the Remi Repo: (I didn't have to do this, as my config already showed it disabled, but best to double check!)

Code:
nano /etc/yum.repos.d/remi.repo
(then set enabled=0 if it is enabled)​


ADD TO CLOUDLINUX PHP SELECTOR:

These instructions add it for PHP 7.0, but you could add it to 5.6 or 7.1, too, by just duplicating these steps:​

First, we have to copy the libsodium shared object that was installed into the respective alt-php folder (in this case /opt/alt/php70 for PHP 7.0)

Code:
cp /usr/local/lib/php/extensions/no-debug-non-zts-20131226/libsodium.so /opt/alt/php70/usr/lib64/php/modules/libsodium.so

Next, we have to create an ini file for libsodium:

Code:
nano /opt/alt/php70/etc/php.d.all/libsodium.ini

in this file put:​

Code:
; Enable libsodium for PHP 7.0 - this is a comment, put anything here.
extension=libsodium.so
Do the same for any other non-native version of PHP​

Lastly, update cagefs...​

Code:
cagefsctl --force-update
 
  • Like
Reactions: cPanelMichael

Luana Premoli

Well-Known Member
Oct 3, 2016
68
7
8
São Paulo/Brazil
cPanel Access Level
Root Administrator
Hi,

I have the same problem.


Code:
downloading libsodium-1.0.6.tgz ...
Starting to download libsodium-1.0.6.tgz (169,817 bytes)
.....................................done: 169,817 bytes
9 source files, building
running: phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
building in /root/tmp/pear/pear-build-root1XlPUH/libsodium-1.0.6
running: /root/tmp/pear/libsodium/configure --with-php-config=/opt/cpanel/ea-php56/root/usr/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /opt/cpanel/ea-php56/root/usr
checking for PHP includes... -I/opt/cpanel/ea-php56/root/usr/include/php -I/opt/cpanel/ea-php56/root/usr/include/php/main -I/opt/cpanel/ea-php56/root/usr/include/php/TSRM -I/opt/cpanel/ea-php56/root/usr/include/php/Zend -I/opt/cpanel/ea-php56/root/usr/include/php/ext -I/opt/cpanel/ea-php56/root/usr/include/php/ext/date/lib
checking for PHP extension directory... /opt/cpanel/ea-php56/root/usr/lib64/php/modules
checking for PHP installed headers prefix... /opt/cpanel/ea-php56/root/usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking for libsodium support... yes, shared
checking for libsodium files in default path... found in /usr/local
found in /usr
checking for crypto_pwhash_scryptsalsa208sha256 in -lsodium... no
configure: error: wrong libsodium lib version or lib not found
ERROR: `/root/tmp/pear/libsodium/configure --with-php-config=/opt/cpanel/ea-php56/root/usr/bin/php-config' failed

And:

Code:
[email protected] [~]# yum install libsodium-devel
Loaded plugins: fastestmirror, universal-hooks
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                                                 |  11 kB     00:00
 * EA4: 209.85.80.214
 * cpanel-addons-production-feed: 209.85.80.214
 * base: mirror.datto.com
 * epel: pubmirror2.math.uh.edu
 * extras: repos.dfw.quadranet.com
 * remi-safe: repo1.dal.innoscale.net
 * updates: mirror.compevo.com
 * webtatic: us-east.repo.webtatic.com
EA4                                                                                                                                                                           | 2.9 kB     00:00 ...
cpanel-addons-production-feed                                                                                                                                                 | 2.9 kB     00:00 ...
base                                                                                                                                                                          | 3.7 kB     00:00
cpanel-plugins                                                                                                                                                                | 2.9 kB     00:00 ...
epel                                                                                                                                                                          | 4.3 kB     00:00
epel/primary_db                                                                                                                                                               | 5.9 MB     00:00
extras                                                                                                                                                                        | 3.4 kB     00:00
hgdedi                                                                                                                                                                        | 2.9 kB     00:00
remi-safe                                                                                                                                                                     | 2.9 kB     00:00
updates                                                                                                                                                                       | 3.4 kB     00:00
webtatic                                                                                                                                                                      | 3.6 kB     00:00
Package libsodium-devel-0.4.5-3.el6.x86_64 already installed and latest version
Nothing to do
[email protected] [~]#

And:

Download a https://download.libsodium.org/libsodium/releases/libsodium-1.0.12.tar.gz then follow the ritual:

$ ./configure
$ make && make check
$ sudo make install


Thanks!
 

Luana Premoli

Well-Known Member
Oct 3, 2016
68
7
8
São Paulo/Brazil
cPanel Access Level
Root Administrator
Hi.

Which one does it refer to?

I've tried a few ways.



Code:
[email protected] [~]# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
--2017-06-14 14:11:07--  http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Resolving rpms.famillecollet.com... 195.154.241.117, 2001:bc8:33a1:100::1
Connecting to rpms.famillecollet.com|195.154.241.117|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8344 (8.1K) [application/x-rpm]
Saving to: “remi-release-6.rpm”

100%[===========================================================================================================================================================>] 8,344       --.-K/s   in 0s

2017-06-14 14:11:08 (472 MB/s) - “remi-release-6.rpm” saved [8344/8344]

[email protected] [~]# rpm -Uvh remi-release-6*.rpm
warning: remi-release-6.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
error: Failed dependencies:
        epel-release = 6 is needed by remi-release-6.8-2.el6.remi.noarch
[email protected] [~]#
 
Last edited: