• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 208
  • Last Modified:

php install libsodium errors out...

I am getting an error when installing libsodium through php pecl.

sudo add-apt-repository ppa:chris-lea/libsodium - No problems
sudo apt-get update && sudo apt-get install libsodium-dev - No problems
pecl install libsodium - ERROR

The error is thrown because of libsodium being installed at version 1.0.3

I believe I need version 1.0.9 or greater.

How can I install the latest version of libsodium so I'm not bombing out when running pecl install libsodium?

My php version is: 7.0.25
Andrew Derse
Andrew Derse
  • 2
  • 2
1 Solution
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Well you're already using alternative PPAs, try this simple solution.

PHP-7.2 add libsodium as a standard module.

# Setup latest stable
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php </dev/null
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/apache2 </dev/null

# Setup PHP-7.2
apt-get install php7.2-fpm php7.2-cli php7.2-mbstring php7.2-zip \
                php7.2-mysql php7.2-curl php7.2-xml php7.2-xmlrpc php7.2-gd php7.2-soap \
                php7.2-sqlite3 php7.2-mcrypt php7.2-tidy php7.2-xsl php7.2-bz2 php7.2-gmp \
                php7.2-tidy php7.2-bcmath php7.2-bz2 php7.2-dba php7.2-pspell \
                php-xdebug libphp7.2-embed

# Setup Sodium
apt-get install php7.2-sodium

# update PHP CLI, when multiple versions installed
update-alternatives --set php /usr/bin/php7.2

a2enconf php7.2-fpm

Open in new window

Andrew DerseIT ManagerAuthor Commented:
There should be one more line in this, but for the most part it's a solid solution:

sudo apt-get install libapache2-mod-php7.2
service apache2 restart
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
You can only do one of these commands...

sudo apt-get install libapache2-mod-php7.2
sudo apt-get install php7.2-fpm

Open in new window

You have to be careful. Whichever of these two is the last command you execute wins + deinstalls the other.

I suggest you stick with FPM, as you must use FPM to support HTTP2... as of Apache 2.4.26 (as I recall), which is when Apache deprecated libapache2-mod for HTTP2, as the two have always been incompatible + cause odd glitches (crash/restarts).

Best stack to use is mod_event + FPM + mod_http2.
Andrew DerseIT ManagerAuthor Commented:
Well, unfortunately, the php code is not running when I follow your example. It displays the code on the page.

I'm also getting a error on the php7.2-mcrypt module install. Does that happen for you as well?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now