Partial fix is_file(): open_basedir restriction in effect.

Alpha1

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) "********"
}
}
 
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.
 
This may point you in the right direction.
Modify the open_basedir settings in your PHP configuration (See Runtime Configuration).

The open_basedir setting is primarily used to prevent PHP scripts for a particular user from accessing files in another user's account. So usually, any files in your own account should be readable by your own scripts.

Example settings via .htaccess if PHP runs as Apache module on a Linux system:

Code:
<DirectoryMatch"/home/sites/site81/">
php_admin_value open_basedir "/home/sites/site81/:/tmp/:/"
</DirectoryMatch>

open_basedir restriction in effect. File(/) is not within the allowed path(s):
 
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.
 
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?
 
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.
 
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.
 
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.
 
The error being experienced on install is the only thing we've fixed, here.

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.

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.
 
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.
That's also assuming FFMPEG is installed. I can't see many shared hosts offering it due to the resources it can consume.
 
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.
 
Back
Top Bottom