如何从php网页执行程序? [英] How to execute a program from a php web page?

查看:70
本文介绍了如何从php网页执行程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在安装了某些程序的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):

  1. 允许用户 apache 以用户 X 的身份运行程序(以允许拥有完整环境的方式).食谱 ?
  2. 修改用户 apache 的环境.我不知道怎么回事,因为apache是​​ nologin 用户.
  3. 以具有适当环境的用户身份SSH到另一台计算机.这意味着Web服务器与本机之间没有密码(公用/专用密钥)连接.危险吗 ?
  1. Allow user apache to run the program as user X (in a way that allows having the full environment). Recipe ?
  2. Modify the environment of user apache. I don't see how because apache is a nologin user.
  3. 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 ?

问题

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆