Jump to content

fopen denied permission


rubing

Recommended Posts

I get a permission denied warning when trying to write a file to disk using fopen, however fopen is enabled.  I think this comes down to permissions.  My suid and guid for php is 1000, however my directories on my server are all owned by a user 4096.  Do I have to create a common group for php and the user??

 

Alternatively making all folders readable and writeable seems insecure and dangerous.

Link to comment
Share on other sites

shouldn't php run as root?

 

No, Apache starts as root but quickly switches to a non privelleged user. its this user which needs to be able to write to your directories / files.

 

Seems a wierd setup if Apache is running as uid 1000, numbers that high are normally reserved for actual users.

 

Oh, and roots id is always 1.

Link to comment
Share on other sites

sorry i got it a little backwards....here is my user info:

 

uid=1000(bob) gid=1000(bob) groups=1000(bob)

 

and php gives the same uid=1000, gid=1000

 

the directory i am trying to write to is listed as follows:

 

drwxr-xr-x 2 bob bob 4096 Oct 19 00:43 played

 

 

,so there really shouldn't be a problem, right??

 

However I get the following error: 

 

Warning: fopen(../public/played/e_santiago.mp3) [function.fopen]: failed to open stream: Permission denied in /home/bob/public_html/citymusicnow.com/private/lib_php/merge_mp3.inc on line 481

 

 

 

Link to comment
Share on other sites

yeah, but it seems to me that it should work if is set permissions as

700, b/c php is running with user id = 1000, the same as my  user id.  Since the folder is owned by my user, there shoudn't be a problem...yet there is?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.