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
LVL 13
Andrew DerseIT ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.