SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    Belgium
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mkdir and permissions

    Hello,

    I have the following problem when i try to create a directory on a remote server:
    When writing a directory the owner of the directory is set to "apache". From then on I can't see the directory in my ftp-client.
    However on the hosting company's control panel i can see the files with the file manager. But I can't delete them because the owner and group is set to apache.
    The only I would like is that when my script is creating the directory it also sets the owner and the group to my user details.

    The script I use the make the directory is this:

    PHP Code:
    $checkdir "/usr/local/psa/home/vhosts/somesite.be/subdomains/test/httpdocs/img/pic/".$cat."/".$project_id;
      
    if (!
    file_exists($checkdir)) {
    echo 
    $checkdir;
    mkdir ($checkdir0666);


  2. #2
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Provided PHP/Apache owns the file, you can use chown().

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    Belgium
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I tried chown but the server doesn't give me the permissions to change the owner from apache to my username.

    I called my hosting agent and he said that this is something that would be possible when they install phph 5 on their servers.

    In the meantime is there another solution?

  4. #4
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Contact your hosting company support desk.

  5. #5
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Two, one requires more code, the other is insecure to a degree.

    The first is to use PHP's FTP system to move things around under your FTP account rather than the file system.

    The other is to chmod the directory to 777. Not recommended as then anyone else on that server can then put anything they want in that folder and run it. You would need to run a cron or something to monitor that directory for anything that it should have in it. I assume since you have a control panel, you are able to run crons. Again though, not a secure thing to do.


Bookmarks

Posting Permissions

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