Installing RAR Extension on PHP 8.3

Written by tap on

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:
- Install php-dev (phpize) if it isn’t installed yet.
- Get the extension from cataphract
git clone https://github.com/cataphract/php-rar
- Configure and install
cd php-rar/ phpize ./configure && make && sudo make install
- 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
- Restart the PHP-FPM
sudo systemctl restart php8.3-fpm
And here is the result:
Notes: I’m using PHP as FPM on NGINX server.
Comments