chmod question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fouadk
    New Member
    • Jul 2008
    • 5

    chmod question

    hi everyone

    i have created a directory using the mkdir() in a php script...
    i have created that directory in /home/username
    this folder is owned by the group and user www-data
    i am trying to change the ownership to anther user using chown() but it gives me permission denied...

    how to overcome this???

    please help

    thanks in advance
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Fouad.

    chown() has to be run with root permissions (http://php.net/chown). There is no way to do this from PHP unless you run Apache as root, which is not recommended.

    Comment

    • henryrhenryr
      New Member
      • Jun 2007
      • 103

      #3
      I changed the default user and group in the apache configuration file - the server is just for testing so it doesn't matter (I hope!) - I got fed up of my scripts breaking because they weren't allowed.

      There is a line in the apache2.conf

      User ...
      Group ...

      I used my user and group.

      Comment

      Working...