XF 1.5 Server errors when uploading an image

tommydamic68

Well-known member
Looks like incorrect permissions on your internal_data/ directory (and sub directories !!) ? Web server has write access, but not read access.

Section 3 @ https://xenforo.com/help/installation/
or https://xenforo.com/community/threads/what-are-the-cmod-permissions-of-folders-inside-data-and-internal_data.44074/
Well, yesterday I messed with settings on my server, updated PHP versions 5.5 t0 5.6 and it screwed up my site, my host was able to reverse it and fix it. But suddenly I couldn't upload images as seen above, so here is what they said after investigating and getting the upload feature to work again, I just hope its not permissions that shouldn't be able to access.

"I am not sure if the problem was because of PHP version change. I just changed the permission of the folders internal_data/ and data/ to 777 and tried upload and it worked."
 

tommydamic68

Well-known member
Just checked ACP and had this server error now.

Code:
ErrorException: file_put_contents(/home/admin/public_html/community/internal_data/templates/S.4,L.1,member_list.php): failed to open stream: Permission denied - library/XenForo/Template/FileHandler.php:95
Generated By: Unknown Account, Today at 12:00 AM
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(2, 'file_put_conten...', '/home/admin/pub...', 95, Array)
#1 /home/admin/public_html/community/library/XenForo/Template/FileHandler.php(95): file_put_contents('/home/admin/pub...', '<?php if (!clas...')
#2 /home/admin/public_html/community/library/XenForo/Template/FileHandler.php(50): XenForo_Template_FileHandler->_saveTemplate('member_list', 4, 1, '<?php if (!clas...')
#3 /home/admin/public_html/community/library/XenForo/Model/Template.php(1695): XenForo_Template_FileHandler::save('member_list', 4, 1, '$__output = '';...')
#4 /home/admin/public_html/community/library/XenForo/Model/Template.php(1470): XenForo_Model_Template->_insertCompiledTemplateRecord(4, 1, 'member_list', '$__output = '';...')
#5 /home/admin/public_html/community/library/XenForo/Model/Template.php(1347): XenForo_Model_Template->compileTemplateInStyleTree(Array)
#6 /home/admin/public_html/community/library/XenForo/Model/Template.php(1565): XenForo_Model_Template->compileMappedTemplatesInStyleTree(Array)
#7 /home/admin/public_html/community/library/XenForo/DataWriter/Phrase.php(367): XenForo_Model_Template->compileTemplatesThatIncludePhrase('likes')
#8 /home/admin/public_html/community/library/XenForo/DataWriter/Phrase.php(273): XenForo_DataWriter_Phrase->_recompileTemplatesIncludingPhrase()
#9 /home/admin/public_html/community/library/XenForo/DataWriter.php(1423): XenForo_DataWriter_Phrase->_postSave()
#10 /home/admin/public_html/community/library/Dark/PostRating/CronEntry.php(19): XenForo_DataWriter->save()
#11 [internal function]: Dark_PostRating_CronEntry::runDailyOptimisation(Array)
#12 /home/admin/public_html/community/library/XenForo/Model/Cron.php(357): call_user_func(Array, Array)
#13 /home/admin/public_html/community/library/XenForo/Deferred/Cron.php(24): XenForo_Model_Cron->runEntry(Array)
#14 /home/admin/public_html/community/library/XenForo/Model/Deferred.php(295): XenForo_Deferred_Cron->execute(Array, Array, 7.99999690056, '')
#15 /home/admin/public_html/community/library/XenForo/Model/Deferred.php(429): XenForo_Model_Deferred->runDeferred(Array, 7.99999690056, '', false)
#16 /home/admin/public_html/community/library/XenForo/Model/Deferred.php(374): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#17 /home/admin/public_html/community/deferred.php(23): XenForo_Model_Deferred->run(false)
#18 {main}
Request State
array(3) {
  ["url"] => string(44) "http://sphynxlair.com/community/deferred.php"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(4) {
    ["_xfRequestUri"] => string(32) "/community/find-new/882197/posts"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
  }
}
Delete...Close
 

Mike

XenForo developer
Staff member
All the directories permissions are set to 0644. I'm not sure they should be set to o777.
It depends specifically on your server config and the exact owner of the file. Given that you're getting errors, you will likely need to go 0777 (at least for any existing files). There may be an alternative approach, but it's certainly more advanced and requires specific knowledge of the owner of those files and the user PHP is running as.

And, I just noticed when you upload an image from an iPhone its sideways.
Your server is likely missing support for PHP EXIF functions. Your host/sysadmin can likely rectify that.
 

tommydamic68

Well-known member
It depends specifically on your server config and the exact owner of the file. Given that you're getting errors, you will likely need to go 0777 (at least for any existing files). There may be an alternative approach, but it's certainly more advanced and requires specific knowledge of the owner of those files and the user PHP is running as.
Well I changed just this file to 0777 - we will see if it stops throwing the server error. I guess it cant harm anything? Hackers or anything of the likes? Access to templates and so on?

Screen Shot 2016-10-30 at 6.35.47 PM.png
 
Top