Php with Apache

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Gélinas

    Php with Apache

    Hi,

    Directly from command line on the server,
    I execute a bash script, that is called from
    a Php script, with no problem.

    But when the Php script is called from Apache,
    I have some permission denied during the
    executin of the bash script, called from
    Php:

    sh: bbx_txt: permission denied.

    Do I have to compiled Apache with some
    feature, like "suexec"?

    Thank you for your help

    daniel
    maridan@abacom. com


  • Google Mike

    #2
    Re: Php with Apache

    Oh, I had this problem. You're probably using those ` chars to shell
    out from inside PHP, right? Like:

    $result = `bbx_txt`;

    (There are about 2 other techniques in PHP to do the same thing, BTW.)

    And I take it that "bbx_txt" is a Bash script. (BTW, my pref. is to
    make such a script named bbx.sh.)

    Okay, for this problem, realize that Apache runs in its own security
    context, not the security context of root or the end user. On RH9
    Linux, for instance, the httpd daemon runs under the user account of
    "apache". Therefore, you have to either use chown or chmod on the file
    in order for the "apache" user account to be able to run it.

    For instance, if you did:

    chown apache.apache bbx_txt

    ....then the web page could probably call that file properly and get a
    result.

    I also recommend starting with very simplistic Bash files (not complex
    ones or ones that call other files) until you get used to this, such as
    one that looks like:

    #!/bin/bash
    echo "hello world"

    Hope this helps! :)

    Comment

    Working...