Summary
I have apache running on a Linux machine where a certain program is installed. I want to call the program from a php page and get the output.
Special constraint
The program needs certain environment variables to run, e.g. LD_LIBRARY_PATH with path to libraries plus extra variables. The environment is defined for a user X on the machine that is not the apache user.
Proposed options
So far I have thought of the following options (not meaning that they are all smart or safe):
- Allow user apache to run the program as user X (in a way that allows having the full environment). Recipe ?
- Modify the environment of user apache. I don't see how because apache is a nologin user.
- SSH to another machine as a user that has the proper environment. It means to have a no password (public/private keys) connection between the web server and this machine. Is it dangerous ?
Questions
- Did I overlook a simpler or better option ?
- What option would you use and why ?