cancel
Showing results for 
Search instead for 
Did you mean: 

[PAYH] Can someone explain what the SAFE MODE restrictions are?

gilbertG
Dabbler
Posts: 23
Registered: ‎16-01-2009

[PAYH] Can someone explain what the SAFE MODE restrictions are?

I keep hitting SAFE MODE permission errors and I wnated to know what exactly are the restrictions in place?
2 REPLIES 2
gilbertG
Dabbler
Posts: 23
Registered: ‎16-01-2009

Re: [PAYH] Can someone explain what the SAFE MODE restrictions are?

This describes safe mode http://uk3.php.net/manual/en/ini.sect.safe-mode.php and as far I can tell it means that you can't create a file or directory unless the parent directory is owned by the same user as the user that owns the script - note the owner of the script NOT the user the script is running as.
So if the script is owned by frank it can only create files or directories in a directory owned by frank. If you create a sub-directory it will be owned by the user that the script is running as - www-data NOT frank - so the script can't then create files or sub-directories in the new sub-directory.
So in other words you can't create directory trees using a script running as www-data because the first  sub-directory the script creates cannot be written to by the script.
The only way around this would be to make the php owner www-data - which I am not sure you can even do and would be a huge security hole (irony is a wonderful thing).
I may have got that wrong, I am no expert, if so please post a reply.
gilbertG
Dabbler
Posts: 23
Registered: ‎16-01-2009

Re: [PAYH] Can someone explain what the SAFE MODE restrictions are?

The way to avoid the Catch 22 I have now discovered is to use cgi-php
See this post http://community.plus.net/forum/index.php/topic,73037.0.html