3 Replies - 1327 Views - Last Post: 10 November 2007 - 04:50 PM Rate Topic: -----

#1 spullen  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 356
  • Joined: 22-March 07

writing a file in php as with right permissions

Post icon  Posted 07 November 2007 - 08:01 PM

I am trying to write to a file in php. It works but, it sets the permission to user www-data, and it only allows read write permissions for www-data.
How would I make it so it saves the permissions so I can read and write to it without having to set the permissions manually?
Is This A Good Question/Topic? 0
  • +

Replies To: writing a file in php as with right permissions

#2 Aurel300  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 230
  • Joined: 10-November 07

Re: writing a file in php as with right permissions

Posted 10 November 2007 - 01:22 PM

Well, what about looking on php.net? :angry:

chmod(string filename, int mode)
filename - URL to the file.
Example: "mydir/myfile.php"

mode - Mode (read, write, execute). Go on php.net and search for chmod function. Itīs too hard to write it here :D .
Was This Post Helpful? 0
  • +
  • -

#3 ellisgl  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 161
  • Joined: 10-November 07

Re: writing a file in php as with right permissions

Posted 10 November 2007 - 01:59 PM

Also CHOWN is another function you would want to look at..

If you can not get these too work you could use the FTP functions in PHP to FTP into your site as your FTP user and change the ownership and permissions that way. (I've had to do it in the past with a mal configured server..). I think I still have the code some where for that method.

View PostAurel300, on 10 Nov, 2007 - 01:22 PM, said:

Well, what about looking on php.net? :angry:

chmod(string filename, int mode)
filename - URL to the file.
Example: "mydir/myfile.php"

mode - Mode (read, write, execute). Go on php.net and search for chmod function. Itīs too hard to write it here :D .

Was This Post Helpful? 0
  • +
  • -

#4 spullen  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 356
  • Joined: 22-March 07

Re: writing a file in php as with right permissions

Posted 10 November 2007 - 04:50 PM

thanks that was exactly what I was looking for, didn't think that these type of functions would be already included in the php language.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1