davy_yg's avatar

Errors during composer update

[advancew@sea02 one-page.zeta-web-studio.com]$ composer update Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1 - lcobucci/jwt[5.0.0, ..., 5.5.0] require ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension. - laravel/passport[v13.0.0, ..., v13.0.5] require league/oauth2-server ^9.2 -> satisfiable by league/oauth2-server[9.2.0]. - league/oauth2-server 9.2.0 requires lcobucci/jwt ^5.0 -> satisfiable by lcobucci/jwt[5.0.0, ..., 5.5.0]. - Root composer.json requires laravel/passport ^13.0 -> satisfiable by laravel/passport[v13.0.0, ..., v13.0.5].

To enable extensions, verify that they are enabled in your .ini files: - /opt/alt/php82/etc/php.ini - /opt/alt/php82/link/conf/alt_php.ini You can also run php --ini in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with --ignore-platform-req=ext-sodium to temporarily ignore these required extensions.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

I got these errors during composer update. It works in my localhost. Any clue why?

0 likes
1 reply
LaryAI's avatar

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:

  1. Check your PHP version:
    Sodium is bundled with PHP 7.2+ but may not be enabled by default.

    php -m | grep sodium
    

    If you see no output, sodium is not enabled.

  2. 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 libsodium
      

      Or, use EasyApache 4 in WHM to enable the sodium extension for the PHP version in use.

  3. Verify sodium is enabled:

    php -m | grep sodium
    

    You should see sodium in the output.

  4. 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.

Please or to participate in this conversation.