Solved Heads up! php exec() does not look in /usr/local/bin/ for executables

so in the terminal if i type-in:
Code:
which tesseract
it shows:
Code:
/usr/local/bin
but user www (apache) does not index those bin's
Can you please suggest a PATH export command to fix it ljboiler? Thank you!!
 
Don't rely on PATH. Use fully qualified paths, especially in scripts.
Hi Dice! yes indeed, I used the full path to the bin. (it was tesseract) in a protected (private) php function.
This got me investigating since i copied a php script from an ubuntu server to the freebsd12 system and ran it (no dependency issues, identical setups) but on the ubuntu it exec()'s as expected, on freebsd it wants the full path. No problem, in fact, I prefer the way the BSD behaves.
 
This got me investigating since i copied a php script from an ubuntu server to the freebsd12 system and ran it (no dependency issues, identical setups) but on the ubuntu it exec()'s as expected,
Probably because on a lot of Linux distributions everything but the kitchen sink gets dumped in /usr/bin. Still shouldn't rely on that. What if someone placed a (backdoored) executable just a little higher up the PATH chain? That's the main reason why you should not rely on PATH in scripts.
 
Back
Top