0

I'm using OSX and MAMP. In my mac terminal, running the following commands gives the following output
whoami gives... pengkong
ffprobe -version gives... ffprobe version 3.3.2 Copyright (c) 2007-2017 the FFmpeg developers...
which ffprobe gives... /usr/local/bin/ffprobe

Using PHP
echo exec('whoami'); also gives... pengkong
echo exec('ffprobe -version'); gives empty back
echo exec('/usr/local/bin/ffprobe -version'); gives libpostproc 54. 5.100 / 54. 5.100

Why am i unable to run ffprobe without specifying the absolute path /usr/local/bin/ffprobe using PHP with the exec() function?

PK.
  • 2,471
  • 3
  • 24
  • 30

1 Answers1

1

exec searches for any specified program in the directories listed in include path. If you only get the expected output for a program via absolute path, it may mean that its parent directory isn't set in the include path so you should set it if you want to execute that program w/o path.

If directory in question is set in the include path and you still get the unexpected behaviour, use the second and third optional parameters of exec to find out about the status of the process.

marekful
  • 14,986
  • 6
  • 37
  • 59