Problems with WAMP and PHP 7.2
Posted by: svent (---.92-221-87.customer.lyse.net)
Date: February 08, 2018 07:54PM

I have tried adding PHP versions 7.2, 7.2.1, 7.2.2 and latest snapshot, and with all, I am unable to use the new cryptography functionality (Sodium).

Trying to use any of the new functions like "sodium_crypto_secretbox_keygen()" etc. throw "Call to undefined function" errors.

Same with any of the predefined constants like "SODIUM_CRYPTO_AUTH_KEYBYTES", they throw a warning for "Use of undefined constant".

Note. Have tried both with and without the Sodium extension loaded, but its same result.


Do anyone have an idea how I can get this new functionality work through WAMP?

Thanks

Options: ReplyQuote
Re: Problems with WAMP and PHP 7.2
Posted by: Otomatic (Moderator)
Date: February 08, 2018 09:18PM

Hi,

Thre is no problem to use sodium.
Load the extension:
Left-Click -> PHP -> PHP extensions -> sodium to check it
Write a file wamp/www/testsodium.php with :
<?php
echo "Value of SODIUM_LIBRARY_VERSION=".SODIUM_LIBRARY_VERSION."<br>";
echo "Value of SODIUM_CRYPTO_AUTH_KEYBYTES=".SODIUM_CRYPTO_AUTH_KEYBYTES."<br>";
echo "Secret box value=".sodium_crypto_secretbox_keygen()."<br>";
?>
In the browser, type : 'http://localhost/testsodium.php' and the result is :
Value of SODIUM_LIBRARY_VERSION=1.0.16
Value of SODIUM_CRYPTO_AUTH_KEYBYTES=32
Secret box value=s��q�(�[,��o�J���"�x���~v _�

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.3 32 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
Wampserver 3.1.3 64 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
PhPMyadmin 4.8.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: Problems with WAMP and PHP 7.2
Posted by: svent (---.92-221-87.customer.lyse.net)
Date: February 08, 2018 10:23PM

Thanks for the reply.

Good to hear it works on your side, manage to get it working on mine as well.

The issue was tied to the "libsodium.dll" file in the PHP folder, and as my windows Path variable was set to the folder for PHP 7.1 it did not find it, and by that did not load it. The strange part about it is that no error was thrown when it tried to load the extension, so it seemed like everything was good.


After I changed my Path variable it workes perfectly.

Options: ReplyQuote
Re: Problems with WAMP and PHP 7.2
Posted by: Otomatic (Moderator)
Date: February 08, 2018 10:51PM

Hi,

Why do you use PATH variable with path to PHP?
Wampserver does not use PATH and does not need it.
Each time you change php version you must also change your PATH.

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.3 32 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
Wampserver 3.1.3 64 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
PhPMyadmin 4.8.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: Problems with WAMP and PHP 7.2
Posted by: svent (---.92-221-87.customer.lyse.net)
Date: February 09, 2018 12:39AM

That is a good question, I do not remember why I added it initially. Might have been out of habit as I've always done a direct install in the past.

Tried removing the PATH variable, and it works. Thanks

Options: ReplyQuote
Re: Problems with WAMP and PHP 7.2
Posted by: Otomatic (Moderator)
Date: February 09, 2018 09:55AM

Hi,

It is a very bad way of programming to use the PATH system environment(*) variable to run an application. There are other ways to do this, especially since in 99.99% of cases, the path is not cleaned when uninstalling the application.

(*) There was no other way of doing things in the 80's with DOS; it was more than 30 years ago!

------------------------------------------------------------------------------------------------------------
Wampserver 3.1.3 32 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
Wampserver 3.1.3 64 bit - Apache 2.4.34 - PHP 7.2.8/7.1.20/7.0.31/5.6.37 - MySQL 5.7.23 - MariaDB 10.3.8
PhPMyadmin 4.8.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote


Sorry, only registered users may post in this forum.