I have set up a Laradock environment with Nginx and php-fpm containers running. From PHP I want to call an executable:
<?php
print exec('whoami'); // www-data
echo "<br>";
exec('/usr/local/bin/assimp version', $output, $returnValue);
print $returnValue; // 127
echo "<br>";
print_r($output); // Array ( )
?>
The return value 127 sounds to me as if the file is not found...
But when I enter the container with the user "www-data" everything works fine:
docker-compose exec --user www-data php-fpm bash
assimp version // -> valid info response
As I was unsure if the executable has to be placed in "workspace" or in the php-fpm container I tried both with the same result. Also putting the executable in the /var/www directory did not help.
The executable was added by the Dockerfile:
USER www-data
COPY ./assimp /usr/local/bin/assimp
COPY ./libassimp.so.4.1.0 /usr/local/lib/libassimp.so.4.1.0
RUN ln -s /usr/local/lib/libassimp.so.4.1.0 /usr/local/lib/libassimp.so
RUN chmod 777 /usr/local/bin/assimp
RUN echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
RUN echo 'export LD_LIBRARY_PATH=/usr/local/lib' >> ~/.bashrc
Any ideas how to fix this issue or how to continue with the debugging? Thanks in advance!