Page 1 of 1

Not allowed to access???

Posted: Sun May 04, 2003 11:33 pm
by skylavelle
What is with this, the damn thing won't work. Just UPLOAD @#$!

Warning: SAFE MODE Restriction in effect. The script whose uid is 549 is not allowed to access /var/www/html/images owned by uid 0 in /home/virtual/site47/fst/var/www/html/modify/imageuploader.php on line 23
upload failed!

Code: Select all

<?
$path = "../images/used/";
$max_size = 200000;
if (!isset($_FILES['file'])) {
    exit;
}
if (is_uploaded_file ($_FILES['file']['tmp_name'])) {
    if ($_FILES['file']['size']>$max_size) {
        echo "The file is too big<br>\n";
        exit;
    }
    if (($_FILES['file']['type']== "image/gif") || ($_FILES['file']['type']== "image/pjpeg") || ($_FILES['file']['type']== "image/jpeg")) {
        if (file_exists($path.$_FILES['file']['name'])) {
            echo "The file already exists";
            exit;
        }
        $res = copy($_FILES['file']['tmp_name'], $path.$_FILES['file']['name']);
        if (!$res) {
            echo "upload failed!";
            exit;
        } else {
            echo "upload sucessful";
        }
    } else {
        echo "Wrong file type";
        exit;
    }
}
?>
Do I need to connect (user, password) to the site, if so how??????

Posted: Sun May 04, 2003 11:59 pm
by phice
Try turning Safe Mode off, if you can.

Posted: Mon May 05, 2003 6:34 am
by skylavelle
8O
Should I be able to turn safe mode off through my admin area? I've never noticed it before, I didn't even know there was such a thing

Posted: Mon May 05, 2003 6:47 am
by []InTeR[]
It's configured in the php.ini

Posted: Mon May 05, 2003 8:21 am
by volka
But since uid 0 is root one might assume you can change php.ini-settings ;)
http://www.php.net/manual/en/features.s ... .safe-mode
If you want to stay with safe mode (or must) make the account with uid 549 the owner of that directory.

Posted: Tue May 06, 2003 8:15 am
by skylavelle
Thanks, I've been in contact with my host and he says that he will turn off safe-mode. Do you think this will solve my problem?

Thanks for the link volka!

Posted: Tue May 06, 2003 9:20 am
by twigletmac
Safe mode being turned off will get rid of the safe mode warnings about uid's and whatnot.

Mac

Posted: Tue May 06, 2003 10:14 am
by volka
I hope php's safe-mode is something that will happen only to other people :twisted:
Although security is something one should care about, safe-mode is a pain in the ass and did me more harm than good.
If the admin is concerned about security he/she/it might be interested in the new "perchild" mpm-module introduced with apache 2. It's still experimental
This MPM does not currently work on most platforms. Work is ongoing to make it functional.
but once it is working (and stable for production systems) I'm sure it will help admins keeping their hair and getting healthy amounts of sleep each day ;)
I -for sure- will mark the day the experimental-note is removed with reason :D

Posted: Tue May 06, 2003 10:16 pm
by skylavelle
Arrrrrgh!

Ok, I have rid my server of safe-mode. However, I am now getting an error message, which I think is in relation to my code.

Warning: Unable to create '../images/used/car.jpg': Permission denied in /home/virtual/site47/fst/var/www/html/modify/imageuploader.php on line 22
upload failed!


Permission denied - what is with that? :cry:

Posted: Tue May 06, 2003 10:23 pm
by r337ard
doesn't look like you have write permissions to the directory

Posted: Wed May 07, 2003 1:28 am
by skylavelle
That is what I think is the problem. I can uplaod files, by using an FTP program though I can not through PHP.

Does anyone know if there is PHP script for connecting to a site?

Maybe similar to connecting to that, which I use to connect to the MySQL database?

I haven't a clue, as to how it should be written so any imput would be great :wink:

Posted: Wed May 07, 2003 1:53 am
by r337ard
i should rephrase. whatever uid/gid the php script is run as, doesn't have write permissions to the directory. your ftp account presumably has different privledges.

Posted: Wed May 07, 2003 3:35 am
by skylavelle
I am confussed :(

Firstly, is there such a script for connecting to sites or is it not necessary?

So how do I change the uid/gid which the php script is run as, in order for it to have the same privileges as the ftp account, thus having write permission?