Having issues with file permissions...

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?
 
What is the ownership of the files?
You may need to chown them.
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.
 
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.
 
Can't get this working...
Code:
        $path = XenForo_Helper_File::getExternalDataPath().'/sitemaps/index.xml';
       
        $file = fopen($path, 'w');
        fwrite($file, $document->saveXML());
        fclose($file);
       
        XenForo_Helper_File::makeWritableByFtpUser($path);
Still getting permission errors.
 
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.
 
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.
 
Top Bottom