Search code examples
phplibsodiumamazon-linuxsodiumamazon-linux-extras

php-sodium on Amazon Linux 2023


php-sodium is absent on Amazon Linux 2023 and can't be easilly installed. So I'll put the solution here as an answer.

Expected to install php-sodium/libsodium on Amazon Linux 2023, but there is no the simple way, because amazon-linux-extras not included as well


Solution

  • sudo yum install php8.1-devel php-pear gcc
    wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
    // verify the file integrity https://libsodium.gitbook.io/doc/installation#integrity-checking
    tar -xvzf LATEST.tar.gz
    cd libsodium-stable
    ./configure
    make && make check
    sudo make install
    sudo pecl install -f libsodium
    //add extension=sodium.so to php.ini
    

    Found this solution on https://github.com/amazonlinux/amazon-linux-2023/issues/204

    Thanks https://github.com/ArronKing for answering