PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
pelegk2
Forum Regular
Posts: 633 Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:
Post
by pelegk2 » Thu Jul 22, 2004 4:00 pm
i am tying to rename a file name :
Code: Select all
Warning: rename(./PDF/1.pdf,./PDF/book1.pdf): Permission denied in web/int/updateFiles.php on line 59
that is on a lnux server an i cant succeed
why is this?what can i do?
thnaks in advance
peleg
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jul 22, 2004 4:02 pm
does the script have write permission for that folder? Does it own the file?
pelegk2
Forum Regular
Posts: 633 Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:
Post
by pelegk2 » Thu Jul 22, 2004 4:17 pm
now when i rename in th e same folder as the script everything is ok !
but when i do
Code: Select all
<?php
here everything is ok
rename("1.pdf","p1.pdf)
but :
here
Warning: rename("/PDF/2/1.pdf","/PDF/p1.pdf"): Permission denied web/int/uf1.php on line 3
and here :
Warning: rename("./PDF/2/1.pdf","./PDF/p1.pdf"): Permission denied web/int/uf1.php on line 3
?>
what can i do?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jul 22, 2004 4:29 pm
you need write permission for all the directories you wish to manipulate.. you probably need to own them as well.
pelegk2
Forum Regular
Posts: 633 Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:
Post
by pelegk2 » Thu Jul 22, 2004 4:47 pm
but its a new folder i have made using ftp and its in my directory on the Host's server
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jul 22, 2004 4:48 pm
that doesn't mean apache uses the same user as your ftp connection..
pelegk2
Forum Regular
Posts: 633 Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:
Post
by pelegk2 » Thu Jul 22, 2004 5:02 pm
iss it possible that i have he same problem when i am trying to d/l a file :
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="123.pdf"');
readfile('./PDF/1pdf');
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jul 22, 2004 5:06 pm
generally, the apache user will be able to read the file, if it exists... depending on the defaults for permissions of uploading through ftp...
pelegk2
Forum Regular
Posts: 633 Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:
Post
by pelegk2 » Thu Jul 22, 2004 5:08 pm
its to download the file
and the file that is d/l is corrupted
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jul 22, 2004 5:14 pm
it may be corrupted by having extra characters enter the stream.. do a binary comparison between the two files, one before download and one after..
pelegk2
Forum Regular
Posts: 633 Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:
Post
by pelegk2 » Thu Jul 22, 2004 5:17 pm
how do i do that execly?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jul 22, 2004 5:22 pm
I generally use a text editor, like
TextPad which has a file comparison function, or just load the files in binary mode. Generally the difference is a space or carriage return at the front or end of file accidently..