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
질문됨 6달 전347회 조회
1개 답변
0
수락된 답변

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
답변함 6달 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠