Magento warning after updating to 2.3.2

After updating from Magento to 2.3.2 you might as well get the following PHP error:

Warning: Use of undefined constant SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13 – assumed ‘SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13’ (this will throw an Error in a future version of PHP) in /var/www/html/vendor/magento/framework/Encryption/Encryptor.php on line 153

After some quick searching on Google, the reason is found: Magento require libsodium due to some security enhancements.
Unfortunately this is not documented well.

Some checks showed that libsodium was already installed, but that installed version did not yet provide the constant which PHP is complaining about.
In my docker environment a newer version is not available out of the box, so I had to add it manually:

wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz \
    && tar xfvz libsodium-1.0.18.tar.gz \
    && cd libsodium-1.0.18 \
    && ./configure \
    && make && make install \
    && pecl install -f libsodium

Now check if pecl added the sodium.ini to your PHP`s conf.d folder to enable the PHP module.

With the following command you can verify if the correct version was installed for libsodium headers + library:

php -i | grep "sodium"

The result should look like this:

sodium
sodium support => enabled
sodium compiled version => 2.0.20
libsodium headers version => 1.0.18
libsodium library version => 1.0.18

Now your Magento installation should work again!

Leave a Reply

Your email address will not be published. Required fields are marked *