Find the answer to your Linux question:
Results 1 to 4 of 4
How do I go about if I wish to fopen() a file that is in /home for instance from a php program? This is a file that I'm not able ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2004
    Posts
    3

    Reading files in /home from php program


    How do I go about if I wish to fopen() a file that is in /home for instance from a php program? This is a file that I'm not able to chmod +666 because it is recreated all the time. Is there some way that I can set the priviliges of the php program to allow it to read files in the entire file system? The system is Redhat 9 and I'm the admin.

  2. #2
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    If your php file is running as a command line script, run the script as root.

    If the script is being called from a webserver, then set the necessary permissions on the /home directory so the apache user/group has read (and write if required) access to it.

    The 3rd option is to modify whatever is creating the file so it chmod's it after it is created.

    Jason

  3. #3
    Just Joined!
    Join Date
    Jun 2004
    Posts
    3
    Quote Originally Posted by jasonlambert
    If the script is being called from a webserver, then set the necessary permissions on the /home directory so the apache user/group has read (and write if required) access to it.
    Jason
    Thanks for the answer! It's being run from a webserver. How do I go about changing the permissions so that apache can read from /home?

    /Alex

  4. #4
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    Location
    England
    Posts
    1,219
    If it is your server why not run apache under that user (Dont if its root)?

Posting Permissions

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