1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

PHP & sudo

Discussion in 'Plesk for Linux - 8.x and Older' started by lhenor, Jun 27, 2005.

  1. lhenor

    lhenor Guest

    I recently upgraded a server from 7.0.4 (FreeBSD) til 7.5.3 (FreeBSD). Most of of the existing data where transferred through PMM sucessfully.

    However, my registration scripts are no longer working. They are simple php calls to sudo shell scripts.

    What have been changed and how can I do s simple workaround for this problem.

  2. hardweb

    hardweb Guest

    Make sure that there is no PHP safe_mode issue. What do you get on the screen from the PHP page?
  3. lhenor

    lhenor Guest

    When i try to run a sudo script I get nothing back from the exec command. However, if I run a simple 'whoami' command I get return..

    PHP safe_mode is off. I guess I should switch safemode on, but I have not touched the config for this domain since v.7.1.x

    Any ideas? - I am stuck here...
  4. hardweb

    hardweb Guest

    If safe_mode is off is ok. The problem is in the script, not in PHP. Are you sure that apache has permissions to execute the script? Have you checked the server error_log?
  5. lhenor

    lhenor Guest

    I have simple test script which tries to exceute the domain creation utility.
    For testing purposes I have granted everyone sudo rights.
    I am using full paths to execute the scripts.

    Exactly the same scripts worked at the old server.


    php: shell_exec("./domainCreate.sh");


    sudo-u root /usr/local/psa/bin/domain.sh $*
    #echo $* >> /usr/autosys/psa/domains/data
  6. lhenor

    lhenor Guest

    After some futher test it seems that it is the domain creation utility that is working..

    I created a root runnable script and sucessfully ran the script from php using sudo command.. whoami also show root..

    How can I workaround this issue?
    The client have access to php...