I need to execute a program using php, the file in question is ClustalW (clustalw2). My apache user is http using fish shell, so I moved clustalw2 to /srv/http/Clustal
and added the dir to fish path.
If I log in into http using terminal and run clustalw2 -INFILE=input_file -OUTFILE=output_file
everything works as expected.
But every time I run shell_exec('clustalw2 -INFILE=input_file -OUTFILE=output_file');
nothing happens and I get this error log: sh: line 1: clustalw2: command not found
If I run:
<?php
echo "USER: ".shell_exec('whoami')."<br>";
echo "SHELL: ".shell_exec('echo "$SHELL"')."<br>";
echo "WHICH clustalw2: ".shell_exec('which clustalw2');
Output:
USER: http
SHELL: /usr/bin/fish
WHICH clustalw2:
If I run which clustalw2
in terminal using http user:
/srv/http/Clustalw/clustalw2