15

I am trying to install the Libsodium PHP extension using PECL, but I have no idea how to get the dll files needed. I want to use it with Wampserver on Windows 7 (64-bit).

Can any one help me?

SeinopSys
  • 8,787
  • 10
  • 62
  • 110
LearningToCode
  • 631
  • 1
  • 12
  • 23
  • try other version not the latest one ! i had the same problem with other php extension ! – Mohsen Oct 08 '15 at 06:15
  • you mean wampserver's old version? Which one should I use? and what are the next steps to be followed? – LearningToCode Oct 08 '15 at 06:16
  • no the libsodium! try multiple version ! here is doc https://paragonie.com/book/pecl-libsodium – Mohsen Oct 08 '15 at 06:19
  • @mohsen.. I was referring to the same document. I am sorry, but I couldn't find how to install it in Wampserver. Can you guide me to any general doc regarding the same? – LearningToCode Oct 08 '15 at 06:26

5 Answers5

13

Here is How I did it.

  1. Download the libsodium from here > For PHP 7.0, For PHP 5.6 And For PHP 5.5 (All x64). #One Important Note, Please download appropriate x86-32 bit or x64-64 bit of this extension matching of your environment from here
  2. Extract the Downloaded file and copy libsodium.dll to wamp->bin->php->php5(x).x.xx Folder
  3. Copy php_libsodium.dll From the extracted File to wamp->bin->php->php5(x).x.xx ->ext
  4. Now Click on the WAMP System tray icon. enter image description here
  5. Go to PHP-> PHP Settings and Click on the enable dl from the menu of the WampManager from the system tray
  6. Now Add bellow line to php.ini from PHP -> php.ini from the menu of Wampmanager, save and close it

extension=php_libsodium.dll

  1. Now Restart Apache or click Restart All Services from the menu of WampManager

You should now get your php_libsodium in the extensions of the php Up and Running. :)

**I didn't notice that, this question is 4 months old. I hope You have solved this.

Asif Kibria
  • 486
  • 3
  • 9
  • 1
    Turns out I was using the wrong version of the extension for the kind of PHP my choice of web dev environment bundle (XAMPP 5.6.15) came with. I had to use the [thread-safe 32-bit](http://windows.php.net/downloads/pecl/releases/libsodium/1.0.2/php_libsodium-1.0.2-5.6-ts-vc11-x86.zip) version to get it to work as intended. I suggest you add a note about needing the proper version into the answer to make it stand out from the other. – SeinopSys Feb 24 '16 at 19:35
6

Wamp 3.2.0 64-bit

Even though in the past apparently more steps were required (see my comment from 2018), today I installed Wamp 3.2.0 64-bit, and when I got an error about libsodium not working, I was able to easily fix it by:

  1. Wamp tray icon > PHP > PHP Extensions > ensure "sodium" is checked
  2. (Wamp will automatically refresh)

I was pleasantly surprised that is worked!

Edit: 24th Feb, 2023

WAMP 3.3.1 64-bit

Additional steps to follow when above two steps are not enough.

  1. Run the cmd php --ini in terminal, and note the php.ini file path like C:\wamp64\bin\php\php8.1.16\php.ini

  2. Locate and open php.ini file

  3. Find and uncomment extension=sodium

  4. Save the file and restart WAMP.

Pratik149
  • 1,109
  • 1
  • 9
  • 16
Ryan
  • 22,332
  • 31
  • 176
  • 357
3

use command prompt :
pecl install libsodium

and go to wamp folder find php.ini in php folder :
append this line: to ini file
extension=libsodium.so


You might be able to achieve this result by running php5enmod libsodium, depending on which webserver you use. Make sure you restart your webserver after installing PECL libsodium


here is good references: https://paragonie.com/book/pecl-libsodium/read/00-intro.md#installing-libsodium

Mohsen
  • 1,295
  • 1
  • 15
  • 45
  • 1
    True... but only if I could get the dll file of my package. It is not available directly. Can you show me a way out to install the extensions which don't have a dll file. Can you also specify in depth, where exactly should I type the command? Is there something for "PECL" that I have to install before typing this command. – LearningToCode Oct 08 '15 at 07:05
  • This page didn't cover installing on Windows. An upcoming update should amend that deficiency. :) – Scott Arciszewski Feb 24 '16 at 20:03
  • Mine had to be `extension=sodium.so` instead (as mentioned here: https://paragonie.com/book/pecl-libsodium/read/00-intro.md). – Ryan Sep 24 '18 at 18:22
3

You can download the dll files you need here: http://windows.php.net/downloads/pecl/releases/libsodium/1.0.2/

  1. Select the version that corresponds with your PHP version, compiler and architecture. (this can be checked using phpinfo(); on your machine)

  2. Copy php_libsodium.dll to "ext" directory (C:\PHP\ext)

  3. Copy libsodium.dll to root of PHP directory (C:\PHP)

  4. Add extension=php_libsodium.dll to php.ini

  5. restart apache

This worked on a standalone version of PHP running on Windows 7, I see no reason why this shouldn't work on WAMP or XAMP.

Roy
  • 51
  • 3
1

You can also use https://github.com/paragonie/sodium_compat. You can simply use :

 composer require paragonie/sodium_compat
jessiPP
  • 436
  • 1
  • 6
  • 21