By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

Permission denied with rename() funcion

P: n/a
i am trying to rename a file using PHP
i have the script as per below

rename("/home/user/public_html/test.htm",
/home/user/public_html/testOLD.htm");

when i run it i get an error Permission denied in the browser - why is this
??

Thanks in advance

Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"chris" <so*****@here.com> wrote in message
news:3f********@funnel.arach.net.au...
i am trying to rename a file using PHP
i have the script as per below

rename("/home/user/public_html/test.htm",
/home/user/public_html/testOLD.htm");

when i run it i get an error Permission denied in the browser - why is this ??

Thanks in advance


Using FTP, CHMOD the file to 777.

--
Sharif Tanvir Karim
http://www.onlyonxbox.net
Jul 17 '05 #2

P: n/a

"Sharif Tanvir Karim" <sh****@nyc.rr.com> wrote in message
news:eq********************@twister.nyc.rr.com...
"chris" <so*****@here.com> wrote in message
news:3f********@funnel.arach.net.au...
i am trying to rename a file using PHP
i have the script as per below

rename("/home/user/public_html/test.htm",
/home/user/public_html/testOLD.htm");

when i run it i get an error Permission denied in the browser - why is this
??

Thanks in advance


Using FTP, CHMOD the file to 777.


is there a way in php to chmod??
--
Sharif Tanvir Karim
http://www.onlyonxbox.net


Jul 17 '05 #3

P: n/a

i have tried chmod() function in PHP

NOW i get an error
Operation not permitted

"Sharif Tanvir Karim" <sh****@nyc.rr.com> wrote in message
news:eq********************@twister.nyc.rr.com...
"chris" <so*****@here.com> wrote in message
news:3f********@funnel.arach.net.au...
i am trying to rename a file using PHP
i have the script as per below

rename("/home/user/public_html/test.htm",
/home/user/public_html/testOLD.htm");

when i run it i get an error Permission denied in the browser - why is

this
??

Thanks in advance


Using FTP, CHMOD the file to 777.

--
Sharif Tanvir Karim
http://www.onlyonxbox.net

Jul 17 '05 #4

P: n/a
chris wrote:
"Sharif Tanvir Karim" <sh****@nyc.rr.com> wrote in message
news:eq********************@twister.nyc.rr.com...

Using FTP, CHMOD the file to 777.

is there a way in php to chmod??


Yes, but php must be the owner of the file. In this case php won't be
the owner so it won't work, you'll just get another similar error
message. You need to use ftp to make this change.

Jul 17 '05 #5

P: n/a
"kicken" <sl***@aoeex.com> wrote in message
news:pXOvb.205026$mZ5.1533427@attbi_s54...
chris wrote:
"Sharif Tanvir Karim" <sh****@nyc.rr.com> wrote in message
news:eq********************@twister.nyc.rr.com...

Using FTP, CHMOD the file to 777.

is there a way in php to chmod??


Yes, but php must be the owner of the file. In this case php won't be
the owner so it won't work, you'll just get another similar error
message. You need to use ftp to make this change.


how can i MAKE php the owner of the file - is this possible??

i have full server access BTW
Jul 17 '05 #6

P: n/a
chris wrote:

how can i MAKE php the owner of the file - is this possible??

i have full server access BTW


I think (but im not sure about that) you have to set the group/owner to
apache (if you are using an apache), more detailed: You have to set the
group and/or owner rights to your http-server, because this is the
service that accesses the file.
Certainly your files have the rights of your user account, but your
Web-Server is another "user" in another group.

Hope this helped,

Greetings, Till.

Jul 17 '05 #7

P: n/a


"chris" <so*****@here.com> wrote in message
news:3f********@funnel.arach.net.au...

i have tried chmod() function in PHP

NOW i get an error
Operation not permitted

"Sharif Tanvir Karim" <sh****@nyc.rr.com> wrote in message
news:eq********************@twister.nyc.rr.com...
"chris" <so*****@here.com> wrote in message
news:3f********@funnel.arach.net.au...
i am trying to rename a file using PHP
i have the script as per below

rename("/home/user/public_html/test.htm",
/home/user/public_html/testOLD.htm");

when i run it i get an error Permission denied in the browser - why is

this
??

Thanks in advance


Using FTP, CHMOD the file to 777.

--
Sharif Tanvir Karim
http://www.onlyonxbox.net


Chris,

CHMOD the file through an FTP program.
--
Sharif Tanvir Karim
http://www.onlyonxbox.net
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.