Find the answer to your Linux question:
Results 1 to 5 of 5
I am running the same software on two different servers... both running php... On the first server the webroot folder has the permissions drwxr-xrwx and the second has... drwxr-xr-x A ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3

    Permission Apache and PHP


    I am running the same software on two different servers... both running php...

    On the first server the webroot folder has the permissions

    drwxr-xrwx

    and the second has...

    drwxr-xr-x


    A php script call fopen to create a new file in web root on both servers and this works fine with the permissions that each server has set up...

    However... When I change the permissions from drwxr-xrwx to drwxr-xr-x on the first server it denies requests from php to create a new file in the folder...

    On the second server when I change drwxr-xr-x to drwxr-xrwx the server throws a 500 misconfiguration error...

    What is the significance of this and why are these two servers behaving so differently? Please help me understand this.

    James Weisbrod - Web Portfolio

  2. #2
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    Another peice of information that would help with this is the user and group that "own" the files. If you can provide these, this may help.

    Also, is fopen creating new files, or editing existing ones? If editing existing ones, provide thos files user/group/permissions.
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3
    the first server with the web root folder permissions set to...

    drwxr-xrwx ftpuser ftpuser

    is owned by the ftp user and the group belongs to the ftp user...

    and the second one with the permissions.

    drwxr-xr-x ftpuser ftpuser

    is owned by the ftp user and the group belongs to the ftp user...


    fopen is trying to open files which do not exist... fopen('somefile.txt','w')



    The only glaring difference between servers from my perspective is that the first one is running hsphere and the second one is running cpanel.


    I am worried that one has a security issues... the first one.

  4. #4
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3
    anyone figure this out? I should mention that the second server does not allow .htaccess files beyond (deeper than) the web root folder... I'm not sure if that gives any clues... but I thought I would add it.

  5. #5
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    I just noticed having read it again. The first one is 757 where the 2nd one is 755. Have you tried recursively setting the permissions on the folders/files to be the same, to rule out the possibility of permissions being the case. Also, it DOES matter about the parent folder's permissions when trying to create new files. So check that's writable by the apache user as well
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •