So I am working with Flyway and I run specific commands using PHP exec() function:
exec('/path/absolute/flyway info');
These commands work as long as I specify the absolute path, but that may vary depending on the machines that it will be working on. That is why I want to use a variable which determines that absolute path, through the command exec('which flyway')
.
The thing is that this returns a null value, even though when I write it directly in shell I get the desired result. I also tried using the php interactive shell php -a
, where if I run the command echo exec('which flyway')
it also returns the desired path, altough when I write it directly in my code, I get the NULL result.
Note that if I want to verify the absolute path of php (which php
), I can do that in the shell, php -a or in my code, and it returns the desired result in all three cases. So the which flyway
command is the only one that has a null result in my code.
Can anyone please help me in this matter ?