Hello guys,

how can I get around this problem:
Warning: SAFE MODE Restriction in effect. The script whose uid is 556 is not allowed to access /home/restricted/tmp/phpy2WNP9 owned by uid 0 in /home/restricted/home/uniflores/public_html/cgi/upload.php3 on line 29

I've read a lot of things, but haven't found the solution...

Thanks in advace,

    • [deleted]

    What is the problem, the fact that there is a safe mode or the fact that it doesn't work in safe mode?

      talk to your web host/isp. they've restricted file uploads and other operations using the php safe mode.

        Awhile ago there was some discussion on #php , this use was proposed (by onki) :

        $tmp_name = $HTTP_POST_FILES['userfile']['tmp_name'];
        
        move_uploaded_file ($tmp_name, '/home/httpd/html/upload/example.zip');
        
        chmod('/home/httpd/html/upload/example.zip', 0644);

        And it works. move_uploaded_file() is the key here. Haven't personally tried it as the safe mode server I have access to is 4.0.2 and move_uploaded_file is a 4.0.3 function.

        What I did was get a script called chuid from here :

        http://www.srparish.net/scripts/

        It must be installed by sysadmin. Then, users do something like this :

        ... <input type="file" name="file"> ...
        
        passthru ("chuid $file 1033"); 
        @copy($file, "/path/to/uploads/$file_name") 
            or die ("could not copy file $file_name");

        Something like that. The above (1033) is the users uid which of course is different for everyone. It can be echo'd in shell like this :

        echo $UID

        But that's more complicated :-)

          Thanks to everyone who has answered to this question.... I got my problem solved after I called my host service.... now I am using a php script but with cgi extension... and it's located in a directory which has 755 chmod ... now everything works fine...
          this guy who I spoke with... told that if the safe mode is on... it's not possible to make upload, coz the webserver doesn't give authorization to a public connection to write in the server...

          Thank you everyone,

            "this guy who I spoke with... told that if the safe mode is on... it's not possible to make upload, coz the webserver doesn't give authorization to a public connection to..."

            that's BS...

            cuz safe mode is something related to PHP and not the webserver... besides, you can still do fileuploads in safemode with commands suchas move_uploaded_file(), unless offcourse, those commands have been disabled in the php.ini

              Write a Reply...