Andrea
Andrea

Reputation: 45

Using Libsodium with PHP on WAMP

I'm having really hard trouble installing libsodium on my local server (WAMP64).

I used this guide and many others, but still no luck.

I successfully installed PEAR but I can't use it to install the PHP wrapper of libsodium. Can someone post a little guide step by step to help me?

ERROR: The DSP libsodium.dsp does not exist.

I would appreciate help installing Halite, wich needs libsodium, because maybe it will be my next step.

Thank you everyone.

Upvotes: 3

Views: 2550

Answers (3)

Mudassir
Mudassir

Reputation: 408

  1. goto WAMPSERVER and install listed PHP
  2. Enable sodium and check in 'Show PHP loaded Extensions' it will get loaded sodium enable pic
  1. check-in PHP module if sodium is available or not with the following command

    cmd> php -m cmd> php --ri sodium

  2. if sodium is not listed then go to your /php/php.ini and search for ';extension=sodium' and remove ';' you will be good to go

Upvotes: 0

Kenny Johnson
Kenny Johnson

Reputation: 784

On Windows, download the appropriate zip file for your version of PHP and then follow these three steps. (I used 1.0.6 for PHP 7.0 in my testing).

  1. Copy libsodium.dll to the System32 Folder or the same directory as php.exe. Also copy it to the apache/bin/ folder (for me that was C:\xampp\apache\bin).
  2. Copy php_libsodium.dll to the PHP extension directory (C:\xampp\php\ext\ for me)
  3. Add extension=php_libsodium.dll to your php.ini file.

The bolded part in step 1 is what I was missing. As soon as I placed the dll in that folder and restarted Apache, everything started working.

You can create a new php file with this code to verify it is working properly:

<?php
var_dump([
    \Sodium\library_version_major(),
    \Sodium\library_version_minor(),
    \Sodium\version_string()
]);

Upvotes: 6

cweiske
cweiske

Reputation: 31088

Do Not Try To Install Pecl Extensions On Windows With Pear/Pecl. It Will Not Work.

Rather use pre-compiled .dll file.


The guide page even says so:

Installing Libsodium and the PHP Extension on Windows

On Windows, download the appropriate zip file for your version of PHP and then follow these three steps.

Upvotes: 1

Related Questions