Find the answer to your Linux question:
Results 1 to 2 of 2
This problem has been discussed before, but no one seems to have a solution. chmod does not work with files inside the Apache server. I thought it'd work with everything ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    15

    PHP's chmod does not work

    This problem has been discussed before, but no one seems to have a solution.

    chmod does not work with files inside the Apache server. I thought it'd work with everything inside /var/www/ , but it isn't doing it, and this a serious problem. I need to set certain httpdocs directories to 0777 for a few seconds and then back to 0755.

    For those familiar with php, the command is like this: chmod('/var/www/directory', 0777);
    It is similar to the normal chmod, but there are, as you can see, differences.

    All these directories are called httpdocs, but being different websites, they are in different directories and have different users, but even then they belong to the same group.

    I went as far as altering the sudoers file to allow user apache to run chmod without the need for a password. Not even that is working.

    Anyone has a solution to this?

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    first, take apache out of sudoers, you just made it so if your website was compromised, someone would have non-password protected root access to your machine

    second, check ownership of directory www, to make sure it is owned by apache user and writeable

    third, make sure all files under that are owned and writeable by apache user

    fourth, i believe there is a security setting that doesn't let you execute stuff by default, but i could be misremembering

Posting Permissions

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