dongqian6484 2014-10-09 17:46
浏览 52

PHP脚本应该在几个命令中执行制造商shell

I am developing a php script that runs on a apache Linux system. It should execute several commands for me. Depending on which command I executed in the my custom php GUI.

Until now I was able to successfully implement this with various shell_exec commands. Now I want to run the following command via php exec script on the Linux system.

AdminTool $IP $USER $PASSWORD shell

Usually when i enter this command on the Linux System itself it opens a connection and runs a shell which is provided by the hardware manufacturer.

Now i want to run this shell using php exec and run the next command within this manufacturer shell. Depends on what I have selected via my custom php GUI.

The shell provides different commands within.

Does anyone know if this can work? And if yes how?

  • 写回答

1条回答 默认 最新

  • douluxia0606 2014-10-09 18:04
    关注

    The shell is just a command line interpreter. Commands are (most of them) names of programs executables and by calling them (using the command) you tell the shell to check if the executable exists in an predefined path (environment paths) and if it does to execute the program.

    I am just guessing but the thing that you run with AdminTool $IP $USER $PASSWORD shell is a program which runs in a command line interface if the parameter "shell" is provided.

    You can not use php exec with the command line interface of the program. Your options are:

    • AdminTool has an API and you comunicate with the program through it
    • You can do the tasks you need to do with the program by passing command parameters e.g.

      AdminTools $ip $user $password dotaskone AdminTools $ip $user $password dotasktwo But looking at the first three parameters you pass I think you make a connection to server. Deppending on the complexity of the things you do with that program (if it is built to take paramaters as commands), that means a lot of program executions - therefore a lot of connections to that server it connects to.

    评论

报告相同问题?

悬赏问题

  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)