简体   繁体   中英

Can I make php run shell scripts?

What I want to do is create a small webpage with 3 links when a particular link is clicked it runs a particular ssh script through console

for example if I wanted to make "STOP" and when it's clicked it would go to a ssh script...say stop.sh and that would just have stop in it, this would stop the server.

Is their an easy way to do this?

Yes, You can run. Following methods allows your to run commands in shell

  1. shell_exec
  2. popen
  3. system
  4. exec
  5. pcntl_exec
  6. proc_open
  7. backtick (`)

Invoking shell is not a good practice. Try to use equivalent PHP functions.

检查执行程序

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM