Our app runs Stata CLI via PHP on different environments but we are having a hard time determining the path of the executable on different environments.
On a Mac using stata-mp
works, while on a different Mac we have to use /usr/local/bin/stata-mp
; on the Linux machine instead we need /usr/local/stata/stata-mp
.
Only the Linux environment used to be different than Mac, but now for some reason we can’t figure out also the Macs are different. The odd thing is that on Terminal/Shell stata-mp
still works for both Macs AND the Linux server...
This is essentially the PHP code we use to execute our Stata script:
$return = exec(static::STATA . " -e do script.do ", $output, $result);
How can we correctly define the Stata path at runtime?
Using Stata MP v16.1