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

Partial Fix is_file(): open_basedir restriction in effect.

Discussion in 'Media Gallery Resolved Bugs' started by Alfa1, Jul 22, 2015.

  1. Alfa1

    Alfa1 Well-Known Member

    On upgrade to latest build:

    Server Error Log
    Error Info
    ErrorException: is_file(): open_basedir restriction in effect. File(/usr/local/lsws/lsphp56/bin/php) is not within the allowed path(s): (/:/tmp:/var/tmp:/usr/local/lib/php/) - library/XenGallery/Model/Transcode.php:162
    Generated By: xxx, A moment ago
    Stack Trace
    #0 [internal function]: XenForo_Application::handlePhpError(2, 'is_file(): open...', '/home/...', 162, Array)
    #1 /library/XenGallery/Model/Transcode.php(162): is_file('/usr/local/lsws...')
    #2 /library/XenGallery/Option/Transcoding.php(12): XenGallery_Model_Transcode->findPhpExecutable()
    #3 [internal function]: XenGallery_Option_Transcoding::verifyOption(Array, Object(vw_XenForo_DataWriter_Option), 'xengalleryVideo...')
    #4 /library/XenForo/DataWriter/Option.php(346): call_user_func_array(Array, Array)
    #5 /library/vw/XenForo/DataWriter/Option.php(32): XenForo_DataWriter_Option->_validateOptionValuePreSave('')
    #6 /library/XenForo/DataWriter/Option.php(211): vw_XenForo_DataWriter_Option->_validateOptionValuePreSave('')
    #7 /library/XenForo/DataWriter.php(1446): XenForo_DataWriter_Option->_preSave()
    #8 /library/XenForo/DataWriter.php(1385): XenForo_DataWriter->preSave()
    #9 /library/XenForo/Model/Option.php(1131): XenForo_DataWriter->save()
    #10 /library/XenForo/Model/AddOn.php(324): XenForo_Model_Option->importOptionsAddOnXml(Object(SimpleXMLElement), 'XenGallery')
    #11 /library/XenForo/Model/AddOn.php(226): XenForo_Model_AddOn->importAddOnExtraDataFromXml(Object(SimpleXMLElement), 'XenGallery')
    #12 /library/XenForo/Model/AddOn.php(169): XenForo_Model_AddOn->installAddOnXml(Object(SimpleXMLElement), 'XenGallery')
    #13 /library/XenForo/ControllerAdmin/AddOn.php(237): XenForo_Model_AddOn->installAddOnXmlFromFile('/tmp/phpMmsMKF', 'XenGallery')
    #14 /library/XenForo/FrontController.php(347): XenForo_ControllerAdmin_AddOn->actionUpgrade()
    #15 /library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
    #16 /admin.php(13): XenForo_FrontController->run()
    #17 {main}
    Request State
    array(3) {
    ["url"] => string(65) "https://site.com/admin.php?add-ons/XenGallery/upgrade"
    ["_GET"] => array(1) {
    ["add-ons/XenGallery/upgrade"] => string(0) ""
    }
    ["_POST"] => array(3) {
    ["server_file"] => string(0) ""
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    }
    }
     
  2. Alfa1

    Alfa1 Well-Known Member

    I know we are not supposed to use beta's in live environments, but my confidence in the XF team is large enough to take such risks (on my own account)
    If you could provide a fix / patch instructions then this would be helpful to me.
     
  3. Jake B.

    Jake B. Well-Known Member

    This may point you in the right direction.
    open_basedir restriction in effect. File(/) is not within the allowed path(s):
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    I was a bit premature in moving it to "Fixed" because there are a few other cases that need to be taken care of.

    Ultimately, though, despite the fix (which will essentially ignore the error), if you plan to allow video uploading it is a configuration that you will need to fix yourself. We need to have access to verify and use the FFMPEG and PHP binary paths, your server isn't currently allowing that.

    Jake B has certainly pointed you in the right direction for that.
     
    Jake B. likes this.
  5. Chris D

    Chris D XenForo Developer Staff Member

    OK, we have fixed this for next beta, but your problems will persist when trying to set up FFMPEG / video transcoding via PHP because those restrictions will still be in effect at locations where we need to access for that system to work (the PHP path and the FFMPEG path).

    Essentially all we have done is prevented this ever happening on install, and in further cases where this might happen we have caught the exception and printed it back in a normal XF error message, but, effectively, this is still a server configuration issue.

    @Alfa1 have you been able to workaround it for now?
     
  6. estranged

    estranged Well-Known Member

    I am not planning to setup video uploads for now. So I don't think this is a server configration issue. Would you mind sharing the patched files?

    Thanks.
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    Easiest fix, find the file library/XenGallery/Option/Transcoding.php

    Below:
    PHP:
    if ($dw->isInsert())
    {
    Add:
    PHP:
    return true;
    It doesn't actually affect your ability to use video uploads, just your ability to get thumbnails from videos or transcode videos.
     
    Alfa1 and estranged like this.
  8. Alfa1

    Alfa1 Well-Known Member

    Thanks for the fix. I will check with my host to set this correctly.
     
  9. Jake B.

    Jake B. Well-Known Member

    It's possible that your host doesn't support FFMPEG.
     
  10. Alfa1

    Alfa1 Well-Known Member

    Then we can make it support it. I run a private cloud on my own hardware. I run LSWS though.
     
  11. MattW

    MattW Well-Known Member

    I can see a lot of shared hosting (including my own), which enforces open_basedir so this has already errored for someone trying to load the beta onto their live site.
     
  12. Chris D

    Chris D XenForo Developer Staff Member

    The error being experienced on install is the only thing we've fixed, here.

    That's a simplified version of the fix we've implemented.

    If any of these people actually do want to generate video thumbnails for videos or transcode videos then they will likely still experience the open_basedir restrictions (albeit (as of the next beta) with friendlier messages).


    I believe open_basedir accepts a colon separated list of paths so the restrictions can be reduced slightly, if needed, rather than completely removed.
     
  13. MattW

    MattW Well-Known Member

    That's also assuming FFMPEG is installed. I can't see many shared hosts offering it due to the resources it can consume.
     
    Xon likes this.
  14. Chris D

    Chris D XenForo Developer Staff Member

    Sure.

    Which is why it's not completely essential for the process of uploading videos.

    Without it, videos can still be uploaded. There will just be no thumbnail (but one can be uploaded manually) and only h264 encoded videos will be accepted.
     
    MattW likes this.

Share This Page