我在安装了某些程序的Linux机器上运行apache.我想从php页面调用该程序并获取输出.
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.
程序需要运行某些环境变量,例如LD_LIBRARY_PATH,带有库的路径以及其他变量.在不是 apache 用户的计算机上为用户 X 定义了环境.
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.
到目前为止,我已经想到了以下选项(并不意味着它们都很聪明或安全):
So far I have thought of the following options (not meaning that they are all smart or safe):
问题
- 我是否忽略了一个更简单或更佳的选择?
- 您将使用什么选项?为什么?
- Did I overlook a simpler or better option ?
- What option would you use and why ? 推荐答案
Questions
您对此平台有完全控制权吗?
Do you have full control over this platform?
您可以查看 suexec 或 mpm-iTK
您可以在虚拟主机中配置以上内容,并将运行身份作为用户或组设置为有权访问您的二进制文件的用户.
You could configure the above within a virtual host, and set the run as user or group to that which has access to your binary.
在当前设置中,您可以创建一个新组,将apache用户/组分配给所述组,将组应用于您要执行的具有读/写或读/执行权限的二进制文件,并让美好时光角色
In your current setup, you could create a new group, assign the apache user/group to said group, apply group to the binary you want to execute with read/write or read/execute permissions, and let the good times role.
更多推荐
如何从php网页执行程序?
发布评论