Installing RAR Extension on PHP 8.3

tap
Written by tap on
Installing RAR Extension on PHP 8.3

One of the app I’m working requires RAR extension on PHP. Unfortunately the latest RAR version doesn’t work on the PHP version installed on my machine (PHP 8.3). Searching the forum for a few minutes gave me this solution:

  1. Install php-dev (phpize) if it isn’t installed yet.
  2. Get the extension from cataphract
    git clone https://github.com/cataphract/php-rar
    
  3. Configure and install
    cd php-rar/
    phpize
    ./configure && make && sudo make install
    
  4. Load it to PHP (I’m using PHP-FPM)
    echo '; configuration for php rar extension'|sudo tee -a /etc/php/8.3/mods-available/rar.ini > /dev/null
    echo 'extension=rar.so'|sudo tee -a /etc/php/8.3/mods-available/rar.ini > /dev/null
    sudo ln -s /etc/php/8.3/mods-available/rar.ini /etc/php/8.3/fpm/conf.d/20-rar.ini
    
  5. Restart the PHP-FPM
    sudo systemctl restart php8.3-fpm
    

And here is the result:

Result

Notes: I’m using PHP as FPM on NGINX server.

tap

tap

Just tap it, will ya

Comments

comments powered by Disqus