# Access to a shell url is possible.

**URL:** <https://discourse.cakephp.org/t/access-to-a-shell-url-is-possible/4985>\
**Category:** Need Help\
**Created:** [September 23, 2018, 3:03pm UTC](https://discourse.cakephp.org/t/access-to-a-shell-url-is-possible/4985 "2018-09-23T15:03:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![albertsuarez](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@albertsuarez](https://discourse.cakephp.org/u/albertsuarez)\
**Post date:** [September 23, 2018, 3:03pm UTC](https://discourse.cakephp.org/t/access-to-a-shell-url-is-possible/4985/1 "2018-09-23T15:03:00Z")

</div>

Hello I would like to have the url to run the shell as I could show it. Thank you very much

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [September 24, 2018, 9:18am UTC](https://discourse.cakephp.org/t/access-to-a-shell-url-is-possible/4985/2 "2018-09-24T09:18:13Z")

</div>

You could use a route + a controller to do so with the `exec()` function from PHP, but do note that this is **INSECURE**.

Why would you want to access the shell from the website anyways?

---

<div class="post-metadata">

**Author:** ![albertsuarez](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@albertsuarez](https://discourse.cakephp.org/u/albertsuarez)\
**Post date:** [October 2, 2018, 5:35am UTC](https://discourse.cakephp.org/t/access-to-a-shell-url-is-possible/4985/3 "2018-10-02T05:35:51Z")

</div>

Thank you very much for your answer, for testing.

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [October 2, 2018, 6:07am UTC](https://discourse.cakephp.org/t/access-to-a-shell-url-is-possible/4985/4 "2018-10-02T06:07:48Z")

</div>

CakePHP seems to have a build-in shell class for this purpose:

```auto
$shell = new ShellDispatcher();
$output = $shell->run(['cake', 'foo']);

```

this will be the equivalent of running `bin/cake foo` in the CLI.  
You can see this article on Medium for more information: [https://medium.com/@narendravaghela/cakephp-execute-shell-command-from-controller-90c8323558a](https://medium.com/@narendravaghela/cakephp-execute-shell-command-from-controller-90c8323558a)

However, I still would advise against this in a production environment, especially if you want to get some of the input from the visitor.
