error permission not permitted |
||
Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.
In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.
Zymic Webmaster Forums Zymic Free Web Hosting Zymic Free Web Hosting - General Discussion & Help |
||
![]() |
error permission not permitted |
||
Sep 25 2007, 02:54 AM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 5 Joined: 21-September 07 Member No.: 367 |
Thanks,
Basically I was doing this on: http://gifs.zxq.net As you can see on the site I am keeping images, and I am having cautions to avoid porn or other abuse images uploaded by the users. Therefore I made a script to list down all and delete. But when I submit the page it gives me the error of "permission denied in xyz page", therefore I changed the chmod("filename",0777) then execute but now it gave me the error permission not permitted in this situation what I suppose to do. And I also chown("filename","user") but it is giving error that unable to find uid "user" 1st I have used my username and then the ftp username but on both I got this please help me as soon as possible as I have to complete this, its complete just this tasks remaining as during upload I am in same situation which is basic for my site. Thanks, Najm. |
|
|
Sep 25 2007, 02:21 PM
Post
#2
|
|
![]() Outrageously Uber Ninja ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrators Posts: 2,831 Joined: 11-March 07 From: UK Member No.: 9 |
There should be no reason to chown the file, the webserver runs via mod_php and file permissions assume that of the webserver (user 'vhostswww' and group 'vhosts'). Your username is completely virtual and the user does not exist in the *nix respect.
By chmoding it to '770' the group ftp users and web server is in should have access to writing to that file. I wrote a little test script: The ftp session (ncftp is my ftp client): CODE ncftp / > mkdir uploads ncftp / > chmod 770 uploads # drwxrwx--- 2 3448 vhosts 4096 Sep 25 15:36 uploads The creation: CODE <?php touch('./uploads/test.txt'); ?> The file write: CODE <?php $fp = fopen('./uploads/test.txt', 'w'); if($fp !== false) { fwrite($fp, 'Some content'); fclose($fp); echo 'Content written.'; } else { echo 'Error. Can not open file pointer.'; } ?> This went without a hitch, the contents of that file being 'Some content'. Directory listing was also fine: CODE $dir = opendir('./uploads'); while($file = readdir($dir)) { if($file == '.' || $file != '..') continue; echo $file, "\n"; } So there is no need to chown or chmod inside of your script, providing the directory / file has sufficient permissions it will write to it, and you'll be able to list the contents. |
|
|
Sep 27 2007, 08:45 AM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 5 Joined: 21-September 07 Member No.: 367 |
I have attached the snapshot of my site,
See what I am talking about or if something missing in my script as it do not seems to be working for me, and I haven't encounter this before any where else I have done this for many of my developements. And yes, I am a programmer, working as a freelancer, with some group of friends. So please contact us for your site development or software... my developements include: http://www.adpstaffing.com http://www.tehran1.com http://www.divinefootball.com Najm. Karachi, Pakistan. Ph: 092-021-0333-3938631 |
|
|
Sep 27 2007, 01:52 PM
Post
#4
|
|
![]() Outrageously Uber Ninja ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrators Posts: 2,831 Joined: 11-March 07 From: UK Member No.: 9 |
You won't be able to define an absolute path, you will need to define one relevant to your 'htdocs' directory. The basedir restriction restricts you from moving beyond this directory.
So where you have an absolute location like '/www/zxq.net/g/i/f/gifs/htdocs' you would simply refer to it as './'. |
|
|
Sep 27 2007, 07:19 PM
Post
#5
|
|
|
Newbie ![]() Group: Members Posts: 5 Joined: 21-September 07 Member No.: 367 |
Thanks, it really worked some how, but again there is permission denied error I tried to resolve it, but I just quit and willing to solve it from here.
I have no such script in my page, which is throwing this complete url instead of "./" as you told, it is spitting it by itself on error: "images/mcat9/scat5/i829400.gif' in /www/zxq.net/g/i/f/gifs/htdocs/upload.php on line 96 Glad to have your quick response, feeling lucky. Thanks. |
|
|
Sep 28 2007, 07:47 PM
Post
#6
|
|
|
Newbie ![]() Group: Members Posts: 5 Joined: 21-September 07 Member No.: 367 |
today I tried to solve the issue, but I resolve the errors which were being thrown during move_ploaded_file() but file is still not uploading without any error, I am just confused about the temp directory where it is keeping the uploaded files, as I just put the "/www/" and my directory image folder to put the file in it. But it is niether moving or may not be uploaded.
Quite confused..... Please help me |
|
|
Sep 28 2007, 10:07 PM
Post
#7
|
|
![]() Outrageously Uber Ninja ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrators Posts: 2,831 Joined: 11-March 07 From: UK Member No.: 9 |
Which directory are you trying to move from?
I just tested a simple: CODE $destination = './uploads/' . basedir($_FILES['foo']['name']); move_uploaded_file($_FILES['foo']['tmp_name'], $destination); It moved the temp file from '/tmp' to './uploads', the uploads directory had a chmod value of '770'. CODE print_r($_FILES) You won't have access to write to or read '/www', so this sounds like your issue. Hope that helps. |
|
|
Oct 1 2007, 10:51 AM
Post
#8
|
|
|
Newbie ![]() Group: Members Posts: 5 Joined: 21-September 07 Member No.: 367 |
Thanks for the upload example I got your point, but I don't know why I am unable to complete this project.
Error I got: CODE Main Dir: ./images/mcat1 Sub Dir: ./images/mcat1/scat1 Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 3529 is not allowed to access /www/zxq.net/g/i/f/gifs/htdocs/images/mcat1 owned by uid 2001 in /www/zxq.net/g/i/f/gifs/htdocs/upload.php on line 17 Script I used: CODE $baseurl = "./"; $main_dir = $baseurl."images/mcat1"; echo "Main Dir: ".$main_dir."<br>"; if(is_dir($main_dir)){ echo "Directory is there.<br>"; } else { mkdir($main_dir); } $sub_dir = $baseurl."images/mcat1/scat1"; echo "Sub Dir: ".$sub_dir."<br>"; if(is_dir($sub_dir)){ echo "Sub Directory is there.<br>"; } else { chmod($main_dir,777); mkdir($sub_dir); } die(); With this script the first directory is creating but not the 2nd directory, which is unusual, I was using FTP at the same time and as I tried to list the 1st directory created by this script it gave me ftp error 'could not retrieve directory listing'. I don't know if these are security issues which are not letting me to complete this project, as I never face them any where else, my first experience. |
|
|
Jan 31 2008, 10:49 AM
Post
#9
|
|
|
Newbie ![]() Group: Members Posts: 3 Joined: 31-January 08 Member No.: 8,498 |
Thanks for the upload example I got your point, but I don't know why I am unable to complete this project. Error I got: CODE Main Dir: ./images/mcat1 Sub Dir: ./images/mcat1/scat1 Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 3529 is not allowed to access /www/zxq.net/g/i/f/gifs/htdocs/images/mcat1 owned by uid 2001 in /www/zxq.net/g/i/f/gifs/htdocs/upload.php on line 17 Hi, i'm getting the same error. What exactly is restricted? Is it actually possible to upload files? |
|
|
![]() |
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users) |
||
| 0 Members: | ||
Forum Jump |
||
| Lo-Fi Version | Time is now: 20th May 2013 - 01:34 AM |