Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Draft saved
Draft discarded
Cancel
28
  • Do you receive any error message ? Commented Jun 3, 2017 at 8:20
  • Note that the apache default user is www-data. Commented Jun 3, 2017 at 8:22
  • @JazZ No special error message as the error reporting is off but when I run the bash file from command prompt the following error occurs: su -s /bin/sh apache -c "scripts/test.sh" Hi from test.sh touch: cannot touch ‘file.log’: Permission denied Commented Jun 3, 2017 at 8:31
  • 1
    Possible duplicate of Run Bash Command from PHP Commented Jun 3, 2017 at 8:44
  • 1
    Note: I chaged the PHP script to shell_exec('sh /var/www/html/scripts/test.sh'); as @JazZ advised, this time, Hi from test.sh appeared in the output, but still failed to run second line of bash. Commented Jun 3, 2017 at 8:49

default

AltStyle によって変換されたページ (->オリジナル) /