The error message indicates that the sodium PHP extension (ext-sodium) is missing on your server, but it is required by the lcobucci/jwt package, which is a dependency of league/oauth2-server and ultimately laravel/passport.
Why it works on localhost:
Your local machine likely has the sodium extension installed and enabled, so Composer can resolve all dependencies there.
How to solve it on your server:
-
Check your PHP version:
Sodium is bundled with PHP 7.2+ but may not be enabled by default.php -m | grep sodiumIf you see no output, sodium is not enabled.
-
Enable or install sodium:
-
On Ubuntu/Debian:
sudo apt-get install php-sodium sudo service apache2 restart # or restart php-fpm if using it -
On CentOS/AlmaLinux/RHEL:
sudo yum install php-sodium sudo systemctl restart httpd # or restart php-fpm if using it -
On cPanel/CloudLinux (since your path is
/opt/alt/php82/):/opt/alt/php82/usr/bin/pecl install libsodiumOr, use EasyApache 4 in WHM to enable the sodium extension for the PHP version in use.
-
-
Verify sodium is enabled:
php -m | grep sodiumYou should see
sodiumin the output. -
Run composer update again:
composer update
Temporary workaround:
You can run Composer with --ignore-platform-req=ext-sodium to skip the requirement, but this is not recommended for production as the extension is actually needed by your dependencies.
composer update --ignore-platform-req=ext-sodium
Summary:
Install and enable the sodium extension on your server to resolve this error. This will allow Composer to install all required dependencies for your Laravel project.