Permission Denied
Moderators: egami, macek, gesf
I'm getting this error but I don't know what permissions to change. Basically I'm trying to copy an uploaded file from the /tmp to a home directory /home/carshow/webspace/images/cars but it say permission denied...it's screwed up.
-
- New php-forum User
- Posts: 71
- Joined: Sun Mar 09, 2003 10:29 am
- Location: Pennsylvania, USA
- Contact:
I had the same problem when I moved some PHP development work from a server running regular PHP to one running the Apache PHP module.
After many tech support calls, I discovered that many files on an Apache server running the PHP module end up getting owned by the Apache server rather than the owner of the website. I believe that happens to files copied to the Apache server... I know it happens with files that are created on the server by a PHP fopen that creates a new file. Again, my experience only relates to servers running the Apache PHP module. With regular PHP, there is no problem.
The only way I've found around it is to immediately CHMOD 0777 the copied or created file... That sets all permissions open. In my case that was not a problem, but in some cases there may be a security problem created.
If anyone knows any other solutions, I'd be delighted to hear about them...
After many tech support calls, I discovered that many files on an Apache server running the PHP module end up getting owned by the Apache server rather than the owner of the website. I believe that happens to files copied to the Apache server... I know it happens with files that are created on the server by a PHP fopen that creates a new file. Again, my experience only relates to servers running the Apache PHP module. With regular PHP, there is no problem.
The only way I've found around it is to immediately CHMOD 0777 the copied or created file... That sets all permissions open. In my case that was not a problem, but in some cases there may be a security problem created.
If anyone knows any other solutions, I'd be delighted to hear about them...
-
- New php-forum User
- Posts: 71
- Joined: Sun Mar 09, 2003 10:29 am
- Location: Pennsylvania, USA
- Contact:
No I didn't... The I used the PHP copy function because the copy routine is part of a selective reset routine in a PHP program I'm developing... i.e. it resets files to their original state after being changed, mauled, mucked up, by a user of the program.
hmmmm... my sig below wasn't working... I fixed it...
hmmmm... my sig below wasn't working... I fixed it...

If php is installed as an apache module it will use the webserver's user usually "nobody" then I would use chmod 777 if you want to further write or del the file. If it is run as a CGI it should run as your username on the shared host.
The apache module is faster and I believe multithreaded. so there are some tradeoffs.
The apache module is faster and I believe multithreaded. so there are some tradeoffs.