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

cron php script safe_mode

Discussion in 'Plesk for Linux - 8.x and Older' started by jospBln, Aug 15, 2005.

  1. jospBln

    jospBln New Pleskian

    23
     
    Joined:
    Dec 3, 2004
    Messages:
    17
    Likes Received:
    0
    hello,

    I have a php script, which is working and executeable via shell, without any problem.

    Now I want to run a cron on this script. But now I get the error:

    Warning: copy(): SAFE MODE Restriction in effect. The script whose uid is 10004 is not allowed to access /home/httpd/vhosts owned by uid 0 in /home/httpd/vhosts/mydomain/httpdocs/get_tpl.php on line 9

    So I turned off safe_mode with
    <Directory /home/httpd/vhosts/mydomain/>
    php_admin_value safe_mode 0
    </Directory>

    did a
    /usr/local/psa/admin/bin/websrvmng -a

    and a
    rcapache2 restart

    But it's still the same!
    Where should I start?

    thanks
    Joerg
     
  2. jamesyeeoc

    jamesyeeoc Guest

    0
     
    Turning off safe mode is not necessarily the best thing to do, but you should first remove the trailing / from the <Directory line:

    <Directory /home/httpd/vhosts/mydomain>

    and restart apache and test it again.

    Does the script have to reside in the domain's docroot? An alternative would be to use phpsuexec to run the script. Whoops, nevermind about phpsuexec, just noticed you want to run from cron... From cron you should be able to run the script as root (uid=0). Put the script in root's cronjob list, not the domain user's.
     
  3. jospBln

    jospBln New Pleskian

    23
     
    Joined:
    Dec 3, 2004
    Messages:
    17
    Likes Received:
    0
    hhmmm..... I deleted the slash, but it didn't help....

    I still got
    "The script whose uid is 10004 is not allowed to access /home/httpd/vhosts owned by uid 0 in /home/httpd/vhosts/mydomain/httpdocs/wm_include/get_tpl.php on line 9"

    Why does the script want to access /home/httpd/vhosts ?

    It just copies an html site via httpd to a local directory. And this directory is
    /home/httpd/vhosts/mydomain/httpdocs/material

    Do you have any idea?
     
  4. jamesyeeoc

    jamesyeeoc Guest

    0
     
    First, uid=10004 is what user? The domain ftpuser? Have you made sure the ownership of the source and destination directories and script file are ftpusername : psacln (using chown). And that there are Read and Write permissions...

    Does this error happen when you run the script as a cron job or are you currently running it from a site page?

    Also, since the script is within the docroot, you aren't using hardcoded paths which reference /home/httpd/vhosts/... are you? If so, try using just /material, since / would be the domain's docroot.

    I think I'm getting a bit lost on this... need sleep soon.
     
  5. jospBln

    jospBln New Pleskian

    23
     
    Joined:
    Dec 3, 2004
    Messages:
    17
    Likes Received:
    0
    hey, thanks for your help! It was the path.

    I had a relative path and needed the absolute path.

    Thanks
    Joerg
     
Loading...