0

According to https://paragonie.com/book/pecl-libsodium/read/00-intro.md#extension-versions libsodium can be installed on PHP versions as low as 5.4. For PHP 5.x you have to use PECL v1.0.6 (as opposed to v2.0.7).

Here's my attempt to get it working on PHP 5.5:

FROM php:5.5

RUN apt-get update \
    && apt-get -y install libsodium-dev \
    && pecl install libsodium-1.0.7 \
    && docker-php-ext-enable libsodium

That gets me the following error:

configure: error: wrong libsodium lib version or lib not found
ERROR: `/tmp/pear/temp/libsodium/configure --with-php-config=/usr/local/bin/php-config' failed
error: /usr/local/lib/php/extensions/no-debug-non-zts-20121212/libsodium does not exist

usage: /usr/local/bin/docker-php-ext-enable [options] module-name [module-name ...]
   ie: /usr/local/bin/docker-php-ext-enable gd mysqli
       /usr/local/bin/docker-php-ext-enable pdo pdo_mysql
       /usr/local/bin/docker-php-ext-enable --ini-name 0-apc.ini apcu apc

Possible values for module-name:
opcache.so

If I replace FROM php:5.5 with FROM php:5.6 it works fine.

Any ideas?

neubert
  • 15,947
  • 24
  • 120
  • 212
  • @LinPy - adding `pkg-config` to the `apt-get -y install` didn't help. I got the same result. – neubert Oct 17 '19 at 05:34
  • then i am afraid your qurstion is a duplicate for : https://stackoverflow.com/questions/48764866/php-installing-libsodium-to-php-v5-5 – LinPy Oct 17 '19 at 05:36
  • @LinPy - no it isn't. The question you link to is about installing it on Windows. He's using pre-compiled binaries. Further, as the answer reveals, in his case, libsodium was installed the entire time. The only difference was that he was using the 1.0 version of the libsodium extension whereas he was trying to write code for the 2.0 version. – neubert Oct 17 '19 at 11:26
  • If you are still using PHP 5 I strongly recommend to upgrade as soon as possible. This version is no longer supported. [Let Rasmus Lerdorf explain it to you](https://youtu.be/wCZ5TJCBWMg?t=2434) – Dharman Oct 19 '19 at 22:49
  • 1
    @Dharman - this is mostly an "academic" exercise. I'm trying to create reproducible benchmarks to show how PHP has sped up over the years. Some of the benchmarks involve crypto stuff and I want to show how much faster it is to do certain operations with libsodium vs pure-PHP. Not that my motivations are relevant to the question at hand – neubert Oct 20 '19 at 00:10

0 Answers0