For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > May 2004 > safe_mode and mkdir in a loop









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author safe_mode and mkdir in a loop
Salmo Bytes

2004-05-22, 11:36 am

I have a script that wants to mirror
a directory structure, reading
from location1 and writing (mkdir) at location2.

This code works fine on a my own desktop test box.
But fails at 'mkdir' when run on virtualhost box
with safe_mode enabled and virtual (chrooted?)
filesystems.

My script makes the first top-level directory just
fine, but fails on subsequent, nested mkdirs,
producing the error message:

Warning: mkdir(): SAFE MODE Restriction in effect. The script whose
uid is 669 is not allowed to access /home/virtual/site...path to dir I
just made

There must be a solution.
chmod($newdir, 0777) doesn't
seem to help.

Php has to solve the lack-of-suexec-behavior problem,
somehow, someway. Else it's a make believe system,
at least in the virtualhost environment.
Tim Van Wassenhove

2004-05-22, 11:36 am

In article <a8c6175f.0405220621.67ed3e45@posting.google.com>, Salmo Bytes wrote:
> My script makes the first top-level directory just
> fine, but fails on subsequent, nested mkdirs,
> producing the error message:
>
> Warning: mkdir(): SAFE MODE Restriction in effect. The script whose
> uid is 669 is not allowed to access /home/virtual/site...path to dir I
> just made


If you create a new directory, the owner of that directory is the user
that runs the webserver (usually www-data or nobody).

With safe mode enabled, you can only access directories that are owned
by you. <>

> Php has to solve the lack-of-suexec-behavior problem,
> somehow, someway. Else it's a make believe system,
> at least in the virtualhost environment.


You can also run php in a suexec environment.



--
Tim Van Wassenhove <http://home.mysth.be/~timvw/contact.php>
iuz

2004-05-22, 1:33 pm

Salmo Bytes wrote:

> I have a script that wants to mirror
> a directory structure, reading
> from location1 and writing (mkdir) at location2.
>
> This code works fine on a my own desktop test box.
> But fails at 'mkdir' when run on virtualhost box
> with safe_mode enabled and virtual (chrooted?)
> filesystems.
>
> My script makes the first top-level directory just
> fine, but fails on subsequent, nested mkdirs,
> producing the error message:
>
> Warning: mkdir(): SAFE MODE Restriction in effect. The script whose
> uid is 669 is not allowed to access /home/virtual/site...path to dir I
> just made
>
> There must be a solution.
> chmod($newdir, 0777) doesn't
> seem to help.
>
> Php has to solve the lack-of-suexec-behavior problem,
> somehow, someway. Else it's a make believe system,
> at least in the virtualhost environment.


the only solution i elaborate its creating dir with ftp function..

if you found another method or want some example code contact me
garbage'AT'iuz-lab.info 'AT' = @

--
--
www.iuz-lab.info
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com