2

I am using the mkdir() to make a new directory, which works. But when I try to upload files(images) to the dir, it gives me the following error:

Warning: imagegif() [function.imagegif]: SAFE MODE Restriction in effect. The script whose uid is 878043 is not allowed to access (dir)/galleries/ny owned by uid 2001 in /www/.../formfunctions.php on line 208

I know what the problem is, but not how to solve it. When I use the mkdir() to create the dir it is given owner id: 2001 and group id: 2001. The owner id should be: 878043 (I was able to see this through Filezilla)

Here is my code for creating the new dir:

$albumName = $_POST['albumName'];
$url = $_GET['url'];

    if (!is_dir("galleries/".$albumName) && $albumName != "") {
        // Hvis albumnavnet er ledigt laves albummet
        mkdir("galleries/".$albumName);
        uploadImagesToAlbum($albumName, $url);
        chmod('galleries/'.$albumName, 0777);

    } else {
        // Hvis albumnavnet er optaget sendes man tilbage og faar en meddelelse
        header('location: '.$url.'?mes=albumOccupied');
    }

So my question is: can I set the owner id through my php code?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Langkiller
  • 3,377
  • 13
  • 43
  • 72
  • How come the mkdir and the imagegif execute as different users? Or do you mean than your provider assigns different (and random) uid to different threads? – ffflabs Sep 22 '13 at 19:29
  • the mkdir and the imagegif don't execute as different users.. I am not entirely sure what's going on.. all I know is that when I use mkdir(), the uid is wrong (= 2001). I just tried using the chown() command, but with no effect – Langkiller Sep 22 '13 at 19:32

1 Answers1

0

you CAN set it using chown but there are security risks involved with letting the php user chown files.

A better solution would be to disable safe mode. Safe Mode

Technobyte
  • 32
  • 2