# Execute Bash Script Using PHP

**URL:** <https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830>\
**Category:** RapidWeaver Classic\
**Created:** [December 29, 2017, 9:11pm UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830 "2017-12-29T21:11:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrandonCorlett](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@BrandonCorlett](https://forums.realmacsoftware.com/u/BrandonCorlett)\
**Post date:** [December 29, 2017, 9:11pm UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/1 "2017-12-29T21:11:58Z")

</div>

I’m about to use rapidweaver to build a control panel for my Raspberry Pi 🙂

[https://www.brandoncorlett.com/blog/article/execute-bash-script-using-php](https://www.brandoncorlett.com/blog/article/execute-bash-script-using-php)

---

<div class="post-metadata">

**Author:** ![Aaron](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/aaron/32/12210_2.png) [@Aaron](https://forums.realmacsoftware.com/u/Aaron)\
**Post date:** [December 29, 2017, 9:49pm UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/2 "2017-12-29T21:49:44Z")

</div>

I’ve been wanting to get into Raspberry Pi - this is very intriguing. Thanks for sharing!

---

<div class="post-metadata">

**Author:** ![BrandonCorlett](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@BrandonCorlett](https://forums.realmacsoftware.com/u/BrandonCorlett)\
**Post date:** [December 29, 2017, 10:47pm UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/3 "2017-12-29T22:47:17Z")

</div>

I love Raspberry Pi. I’ve been working with it for about a year and a half and it’s completely upped my software and hardware development skills. There is a lot more you can do when you have complete control of your server.

Once I get BetaStacks switched over to EchoStacks I may build some Stacks that are specifically designed for use with the Raspberry Pi.

---

<div class="post-metadata">

**Author:** ![isaiah](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/isaiah/32/93_2.png) [@isaiah](https://forums.realmacsoftware.com/u/isaiah)\
**Post date:** [December 30, 2017, 10:07am UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/4 "2017-12-30T10:07:58Z")

</div>

> [@BrandonCorlett](#):
>
> Sometimes it is nice to be able to execute commands on a server machine. In this article we will create a html button that runs a bash commands from a designated file located on the server.

This sounds really cool. If there’s anything we can add to Stacks that would help your Pi development, just say the word. 🙂

---

<div class="post-metadata">

**Author:** ![BrandonCorlett](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@BrandonCorlett](https://forums.realmacsoftware.com/u/BrandonCorlett)\
**Post date:** [December 31, 2017, 9:59pm UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/5 "2017-12-31T21:59:46Z")

</div>

Will do! 🙂

Right now I’m trying to work out how to successfully setup [phpseclib](https://github.com/phpseclib/phpseclib) so I can use ssh sessions to execute commands rather than opening up holes in security with www-data having sudo privileges.

If it works out then I’ll make some phpseclib stacks.

---

<div class="post-metadata">

**Author:** ![instacks](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/instacks/32/23339_2.png) [@instacks](https://forums.realmacsoftware.com/u/instacks)\
**Post date:** [December 31, 2017, 11:47pm UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/6 "2017-12-31T23:47:43Z")

</div>

> [@BrandonCorlett](#):
>
> how to successfully setup phpseclib

You are opening secury holes nevertheless 😃 but as long as it is your server and only reachable in your network, no worries. Happy New Year 🎊

---

<div class="post-metadata">

**Author:** ![BrandonCorlett](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@BrandonCorlett](https://forums.realmacsoftware.com/u/BrandonCorlett)\
**Post date:** [January 1, 2018, 1:52am UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/7 "2018-01-01T01:52:39Z")

</div>

Lol I had the same thought. I’m trying to work out the best way to lock things down for a open network network.

It’s not that big of deal for my current project as the the site it only accessable when on the WiFi network being broadcasted by the Pi. It allows the user to set a Eddystone-url broadcast from the Pi.

Happy New Year! 😁🎆

---

<div class="post-metadata">

**Author:** ![isaiah](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/isaiah/32/93_2.png) [@isaiah](https://forums.realmacsoftware.com/u/isaiah)\
**Post date:** [January 1, 2018, 8:28pm UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/8 "2018-01-01T20:28:13Z")

</div>

I think you could mitigate the security at least partially by ensuring the UNIX user that the web server is running as, only has a very limited access to the file system and no access to most executables.

And, of course, doing the same tasks in Rails or node.js, even if it’s theoretically just another executable scripting language – those scripting languages have been purpose built and well tested as web-back-ends – so will suffer from fewer real-world security holes.

BASH is a lot more fun, tho. 😛

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/system/32/25301_2.png) [@system](https://forums.realmacsoftware.com/u/system)\
**Post date:** [January 7, 2018, 8:28pm UTC](https://forums.realmacsoftware.com/t/execute-bash-script-using-php/17830/9 "2018-01-07T20:28:17Z")

</div>

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.
