Skip to main content

Notice: Undefined offset: 2 in vendor\magento\framework\Encryption\Encryptor.php

Some time you will have the below error after you move Magento2 from server to another server with different PHP version or even with the same PHP version , now what is the first solution we can do 

mostly this library will be missed 

php-sodium

So we need to install it , below is some command we can do to install it on Centos

  • sudo dnf install php74-php-sodium    (for PHP 7.4) 
  • sudo dnf install php73-php-sodium    (for PHP 7.3)
  • sudo dnf install php72-php-sodium    (for PHP 7.2)

after that you need to restart PHP-FPM

Now the idea is to install this library So try to find the good way based on your envionremnt to install it .

Hope this will solve the problem , here is some examples 

  • systemctl restart php72-php-fpm
  • systemctl restart php73-php-fpm
  • systemctl restart php74-php-fpm

 

another links 

php 7.2 - How to install succesfully libsodium (for php7.2) on Centos7? - Stack Overflow

Notice: Undefined offset: 2 in vendor\magento\framework\Encryption\Encryptor.php - Stack Overflow