libsodium and ext-sodium are absent in my Elastic Beanstalk PHP 8.2 platform

0

I have an Elastic Beanstalk environment. The platform is PHP 8.2 running on 64bit Amazon Linux 2023/4.0.2. In my composer file I have a dependency on ext-sodium. I've noticed that sodium was added in AL2023 since version 2023.2.20230920. PHP platform version 4.0.2 uses AL2023 version 2023.2.20231016 which is even higher. My question is what I am missing in getting libsodium and php sodium extension while deploying my application?

Your lock file does not contain a compatible set of packages. Please run composer update.

Problem 1

  • lcobucci/jwt is locked to version 5.2.0 and an update of this package was not requested.
  • lcobucci/jwt 5.2.0 requires ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.

Problem 2

  • lcobucci/jwt 5.2.0 requires ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
  • lexik/jwt-authentication-bundle v2.19.1 requires lcobucci/jwt ^3.4|^4.1|^5.0 -> satisfiable by lcobucci/jwt[5.2.0].
  • lexik/jwt-authentication-bundle is locked to version v2.19.1 and an update of this package was not requested.

I tried to enable extension by adding Elastic Beanstalk config file:

files:
  "/etc/php.d/sodium.ini":
    mode: "000755"
    owner: root
    group: root
    content: |
      extension=sodium.so

but no luck, I got next error:

[ERROR] An error occurred during execution of command [app-deploy] - [Install composer dependencies]. Stop running the command. Error: installing composer dependencies failed with error: Command /bin/sh -c composer.phar install --no-ansi --no-interaction --no-dev failed with error exit status 2. Stderr:PHP Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib64/php8.2/modules/sodium.so (/usr/lib64/php8.2/modules/sodium.so: cannot open shared object file: No such file or directory), /usr/lib64/php8.2/modules/sodium.so.so (/usr/lib64/php8.2/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

MrMySQL
asked 5 months ago308 views
1 Answer
0
Accepted Answer

I've added this config in my app:

.ebextensions/libsodium.config

commands:
    command1:
      cwd: /tmp
      command: wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
    command2:
      cwd: /tmp
      command: tar -xvzf LATEST.tar.gz
    command4:
      cwd: /tmp/libsodium-stable
      command: ./configure
    command5:
      cwd: /tmp/libsodium-stable
      command: make && make check
    command6:
      cwd: /tmp/libsodium-stable
      command: sudo make install
    command7:
      cwd: /tmp/libsodium-stable
      command: sudo pecl install -f libsodium
MrMySQL
answered 5 months ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions