Timeline for Run Bash Command from PHP
Current License: CC BY-SA 3.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 20, 2020 at 16:05 | comment | added | kloodge | I'm having this same problem. I can execute the bash script from both my home dir, and the /var/www/html/ dir. When I run the <php> page, with 'LS' in the the exec('ls') it lists the files in the directory ... but when i put the bash file and path it doesn't work. | |
| Sep 22, 2017 at 9:41 | answer | added | CommanderSpock | timeline score: 0 | |
| S Apr 18, 2017 at 13:28 | history | suggested | Zdeněk Bednařík | CC BY-SA 3.0 |
Fixed grammer a little
|
| Apr 18, 2017 at 12:23 | review | Suggested edits | |||
| S Apr 18, 2017 at 13:28 | |||||
| Jun 15, 2012 at 15:03 | comment | added | Dennis Williamson |
Instead of ./script.sh use /path/to/script.sh.
|
|
| Jun 15, 2012 at 14:24 | vote | accept | r0skar | ||
| Jun 15, 2012 at 14:18 | answer | added | Robert K | timeline score: 98 | |
| Jun 15, 2012 at 14:18 | answer | added | Hrishikesh | timeline score: 5 | |
| Jun 15, 2012 at 14:11 | comment | added | r0skar |
Thanks for your answers. 1)I can run it from terminal. 2) @DanLee Doesnt work. 3)It seems that the php file I am modifying is a shortcut, because allthough I "see" them in the same dir, pwd did return another dir. Is it possible to include the path in the command?
|
|
| Jun 15, 2012 at 14:09 | comment | added | dan-lee |
Does it work with shell_exec('sh script.sh')?
|
|
| Jun 15, 2012 at 14:09 | comment | added | Robert K |
Does your script have an appropriate interpreter header, and can you run it manually from your terminal? Like: #!/bin/bash
|
|
| Jun 15, 2012 at 14:07 | comment | added | Marc B | Is that bash script in the same directory as your PHP script? Is the php script's working directory that same directory as well? | |
| Jun 15, 2012 at 14:06 | comment | added | core1024 |
Is your script executable by apache or www-data user?
|
|
| Jun 15, 2012 at 14:05 | comment | added | alex |
What path are you running it in? What does pwd return?
|
|
| Jun 15, 2012 at 14:03 | history | asked | r0skar | CC BY-SA 3.0 |