I have installed FFMPeg in CentOS. It works perfectly. It's inside /usr/bin directory. Also, I have PHP 7.2.24 that comes with Plesk 18.0.20.
I want to use FFMPeg inside a PHP script, but that script can't find the executable of FFMpeg. I have tried giving the exact route (/usr/bin/ffmpeg) but doesn't work.
It's a production server. The same script, in my development server (macOS) works perfectly.
I tried using:
var_dump(getenv('PATH'));
var_dump(exec('which ffmpeg'));
var_dump(ini_get('open_basedir'));
var_dump(is_file(exec('which ffmpeg')));
var_dump(is_executable(exec('which ffmpeg')));
And it returns me:
string(49) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
string(0) ""
string(44) "/var/www/vhosts/name-of-the-domain.com/:/tmp/"
bool(false)
bool(false)
NULL
¿What could be happening?
A very strange thing I've noticed is that I can't access any command via php: I tried using it with echo
var_dump(exec('which echo'));
var_dump(is_file(exec('which echo')));
var_dump(is_executable(exec('which echo')));
And it returns me:
string(0) ""
bool(false)
bool(false)
NULL
And the permissions are right:
[root@vps bin]# ls -lha echo
-rwxr-xr-x 1 root root 33K ago 20 08:25 echo
[root@vps bin]# ls -lha ffmpeg
-rwxr-xr-x 1 root root 217K abr 4 2019 ffmpeg
But if I make a
var_dump(exec('echo "HELLO"'))
it returns me
string(5) "HELLO"