My docker container is up and I am running the PHP version 8.1. I have installed the unrar inside my container and when I run the command unrar inside the bash I get the version and it is working fine. let me clarify on this part I used the apt-get install unrar
and also did
git clone https://github.com/cataphract/php-rar.git
cd php-rar
phpize
# phpize outputs that it's configuring for php8.1's API
# Configuring for:
# PHP Api Version: 20210902
# Zend Module Api No: 20210902
# Zend Extension Api No: 420210902
./configure && make && make install
But when i run the command inisde my symfony controller as follow i get the error unrar not found.
public function __invoke(Request $request,FileUploader $fileUploader,EntityManagerInterface $entityManager): array
{
.....
elseif ($archiveType === 'rar') {
$command = 'unrar 2>&1';
$output = shell_exec($command);
dd($output);
}
}
I have installed unrar based on the following link Error while installing php rar extension on ubuntu server the problem I have is that when I run the command unrar from my docker container inside the bash I get the unrar command working fine so I use the shell_exec() command inside my Symfony project to run the same command and here I have the error of the unrar not found. how I can remove this inconsistency.