Not a bug acp:store templates as files option: error messagen when creating new style


Well-known member
When I create a new style with the store templates as files option activated, I get this message:

Server Error

file_put_contents(/...internal_data/templates/S.0,L.0,account.css.php): failed to open stream: Permission denied
file_put_contents() in XenForo/Template/FileHandler.php at line 95
XenForo_Template_FileHandler->_saveTemplate() in XenForo/Template/FileHandler.php at line 50
XenForo_Template_FileHandler::save() in XenForo/Model/Template.php at line 1410
XenForo_Model_Template->writeTemplateFiles() in XenForo/Option/TemplateFiles.php at line 23
call_user_func_array() in XenForo/DataWriter/Option.php at line 345
XenForo_DataWriter_Option->_validateOptionValuePreSave() in XenForo/DataWriter/Option.php at line 211
XenForo_DataWriter_Option->_preSave() in XenForo/DataWriter.php at line 1414
XenForo_DataWriter->preSave() in XenForo/DataWriter.php at line 1354
XenForo_DataWriter->save() in XenForo/Model/Option.php at line 568
XenForo_Model_Option->updateOptions() in XenForo/ControllerAdmin/Option.php at line 174
XenForo_ControllerAdmin_Option->actionSave() in XenForo/FrontController.php at line 310
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
XenForo_FrontController->run() in ...admin.php at line 13


the template directory have no permissions

mike, kier shouldn't you throw here an error/notice so the users knows he have to set the permissions manual?

        protected function _createTemplateDirectory()
            if (!is_dir($this->_path)) {
                if (XenForo_Helper_File::createDirectory($this->_path)) {
                    return XenForo_Helper_File::makeWritableByFtpUser($this->_path);
                    return false;

            return true;


XenForo developer
Staff member
mike, kier shouldn't you throw here an error/notice so the users knows he have to set the permissions manual?
You should never have to - it's a requirement that the internal_data directory itself is writable by the webserver. As such, I'm not sure why this would occur without that.

Marcus, did you move servers or anything like that recently?


Well-known member
Today I activated CDN by pointing both as to my forum, pointed these domains directly to /internal_data and first activated and since then I use

I noticed this behavior short after. Ragtek pointed me to the directory permissions. Whenever I put permissions to 0775 it worked and when turned again to 0755 it did not work.

Now it also works with 0755.


Well-known member
I reproduced this bug when creating a new template in debug to a custom addon.

When creating the template I got this error message
I disabled the acp>store template as files option
I could create the new template in debug modus
I enabled the acp>store template as files option
I got this error message
I changed directory permissions to 777
It works


Well-known member
Depending on your server settings on some servers 755 won't work for the data directories you have to use 777 for them. I know on my server the webserver runs as nobody which means for data I have to go with 777, if it's running as a user, as long as that user is the owner of the files you can go with 755.


Well-known member
After a PLESK update today I experienced the same problem again. I changed permissions of internal data directory to 0777 it worked. I changed them back to 0755 and it works now.


Well-known member
The other parts of my internal_data directory can not be written to after my Plesk Update. Now I had to 0777 all these subforums and even the sub-subforums for the attachments.