• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

cron php script safe_mode

jospBln

New Pleskian
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
 
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.
 
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?
 
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.
 
hey, thanks for your help! It was the path.

I had a relative path and needed the absolute path.

Thanks
Joerg
 
Back
Top