1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Having issues with file permissions...

Discussion in 'XenForo Development Discussions' started by Jaxel, Aug 15, 2013.

  1. Jaxel

    Jaxel Well-Known Member

    So with a few of my xenforo scripts, it creates files and directories.

    What I noticed though is that files created through xenforo scripts don't have the right owners. I can't edit/delete the files through my FTP; it doesn't matter what the CHMOD settings are. In order to edit/delete the files, I need to do it through another xenforo script.

    Is there a good way to fix this?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    What is the ownership of the files?
    You may need to chown them.
  3. Jaxel

    Jaxel Well-Known Member

    The owner is listed as "nobody". User/Group of 99/99.
    Last edited: Aug 15, 2013
  4. Jaxel

    Jaxel Well-Known Member

    Unfortunately, I can't chown the files automatically.

    The files are generated on the fly by XenForo... so I need to be able to chown them on the fly as well. Unfortunately, since XenForo is creating the files under the user "nobody", it doesn't have superuser permission to run the chown command.
  5. Mike

    Mike XenForo Developer Staff Member

    You'll want to look at XenForo_Helper_File::makeWritableByFtpUser().

    The files being owned by nobody/apache/httpd is totally expected if you're running mod_php.
  6. Jaxel

    Jaxel Well-Known Member

    Thanks Mike.
  7. Jaxel

    Jaxel Well-Known Member

    Can't get this working...
            $path = XenForo_Helper_File::getExternalDataPath().'/sitemaps/index.xml';
            $file = fopen($path, 'w');
            fwrite($file, $document->saveXML());
    Still getting permission errors.
  8. Mike

    Mike XenForo Developer Staff Member

    I'd recommend you step through debugging what's going on in the make writable function to see if there's a particular reason (which may be expected) as to why it's not working. It works in most cases; when it doesn't, you can force a particular chmod value via config.php.
  9. Jaxel

    Jaxel Well-Known Member

    I figured it out. Instead of running it on the file, I ran it on the directory the file was in and now it works perfectly.

Share This Page