Permission Denied

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

bonkers
New php-forum User
New php-forum User
Posts: 46
Joined: Wed Mar 12, 2003 7:17 pm

Permission Denied

Postby bonkers » Mon Jun 23, 2003 9:13 pm

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.

eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

Postby eyewoo » Tue Jun 24, 2003 7:35 am

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...

bonkers
New php-forum User
New php-forum User
Posts: 46
Joined: Wed Mar 12, 2003 7:17 pm

Postby bonkers » Tue Jun 24, 2003 1:17 pm

When you copied your files, did you use tar and gzip compression? They're really good and keep all the permissions.

eyewoo
New php-forum User
New php-forum User
Posts: 71
Joined: Sun Mar 09, 2003 10:29 am
Location: Pennsylvania, USA
Contact:

Postby eyewoo » Tue Jun 24, 2003 1:33 pm

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... :oops:

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Wed Jun 25, 2003 12:36 am

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.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 6 guests