File uploading issues

Hi,
I’m having problems with uploading files related with php open_basedir setting. Running on FreeBSD, Apache 2.4 and PHP8.0 (installed from packages). Omeka is 3.0.2
Omeka is placed to /data/www/omeka directory.

If open_basedir has default setting (commented out in php.ini) then file upload fails with this error.

    Unable to store file.

Omeka_Storage_Exception: Unable to store file. in /data/www/omeka/application/libraries/Omeka/Storage/Adapter/Filesystem.php:130
Stack trace:
#0 /data/www/omeka/application/libraries/Omeka/Storage.php(67): Omeka_Storage_Adapter_Filesystem->store('/tmp//e15f505df...', 'original/e15f50...')
#1 /data/www/omeka/application/models/File.php(426): Omeka_Storage->__call('store', Array)
#2 /data/www/omeka/application/models/Job/FileProcessUpload.php(23): File->storeFiles()
#3 /data/www/omeka/application/libraries/Omeka/Job/Dispatcher/Adapter/Synchronous.php(25): Job_FileProcessUpload->perform()
#4 /data/www/omeka/application/libraries/Omeka/Job/Dispatcher/Default.php(137): Omeka_Job_Dispatcher_Adapter_Synchronous->send('{"className":"J...', Array)
#5 /data/www/omeka/application/models/File.php(205): Omeka_Job_Dispatcher_Default->send('Job_FileProcess...', Array)
#6 /data/www/omeka/application/libraries/Omeka/Record/AbstractRecord.php(280): File->afterSave(Array)
#7 /data/www/omeka/application/libraries/Omeka/Record/AbstractRecord.php(548): Omeka_Record_AbstractRecord->runCallbacks('afterSave', Array)
#8 /data/www/omeka/application/models/Item.php(338): Omeka_Record_AbstractRecord->save()
#9 /data/www/omeka/application/models/Builder/Item.php(205): Item->saveFiles()
#10 /data/www/omeka/application/libraries/globals.php(567): Builder_Item->addFiles('Upload', 'file', Array)
#11 /data/www/omeka/application/models/Item.php(323): insert_files_for_item(Object(Item), 'Upload', 'file', Array)
#12 /data/www/omeka/application/models/Item.php(233): Item->_uploadFiles()
#13 /data/www/omeka/application/libraries/Omeka/Record/AbstractRecord.php(280): Item->beforeSave(Array)
#14 /data/www/omeka/application/libraries/Omeka/Record/AbstractRecord.php(529): Omeka_Record_AbstractRecord->runCallbacks('beforeSave', Array)
#15 /data/www/omeka/application/libraries/Omeka/Controller/AbstractActionController.php(229): Omeka_Record_AbstractRecord->save(false)
#16 /data/www/omeka/application/controllers/ItemsController.php(88): Omeka_Controller_AbstractActionController->editAction()
#17 /data/www/omeka/application/libraries/Zend/Controller/Action.php(516): ItemsController->editAction()
#18 /data/www/omeka/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('editAction')
#19 /data/www/omeka/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#20 /data/www/omeka/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#21 /data/www/omeka/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#22 /data/www/omeka/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#23 /data/www/omeka/admin/index.php(28): Omeka_Application->run()
#24 {main}

Now changing open_basedir like this in php.ini:

open_basedir = "/data/www/:/var/tmp/:/tmp/:/usr/local/bin/:/dev/urandom:"

Allows file uploads. Everything seem’s to be fine exept now every time omeka web page is loaded it produces an error message to log:

Apr 12 10:36:36 brix php[14451]: PHP Warning:  is_readable(): open_basedir restriction in effect. File(/usr/local/share/pear//data/www/omeka/plugins/HistoryLog/views/helpers/Url.php) is not within the allowed path(s): (/data/www/omeka/:/var/tmp/:/tmp/:/usr/local/bin/:/dev/urandom) in /data/www/omeka/application/libraries/Zend/Loader.php on line 186

I can’t find the source where and why it goes looking for file “/usr/local/share/pear//data/www/omeka/plu…” .
And also note double slashes ...pear//data... in search path.

Can anyone give some hints how to solve this?
Thanks!

The default open_basedir setting is just for open_basedir to be disabled (so to allow opening anything the executing user has permissions to open). I wonder if you might have some other configuration file in play that’s setting some other default there if you comment it out?

The complaints you’re seeing there have to do with the PHP include path (which is probably where the “pear” part is coming from). If you’re stuck with open_basedir, including /usr/local/share/pear/ on there should probably avoid that particular error message. As should simply disabling open_basedir.

Hi,
I created a new temporary test server into virtualbox. Restored database and web directory. Minimal apache and php… configuration and file upload works flawlessly.
I’m still not able to pinpoint it, but i’m trying to get to the bottom of this.
Thanks!

Hi,
This is weirdest issue i ever encountered. So i reached to to the point where configuration was 1:1 with problematic server and in test environment all worked. Out of any ideas i noticed, that in “production” i have ZFS and in test i had UFS. So i created zfs and mounted it to /data and i put web (and omeka) to there. And file uploads failed and everything started to behave like in “production”.
I decided to poke around with some ZFS options and started to get some success. However results are mixed - sometimes it fails, sometimes not. And i can’t pinpoint single option on zfs nor any combination of options so far which could be the game changer.
And most weirdest part is the open_basedir thing in this… Can’t explain…

This topic was automatically closed after 250 days. New replies are no longer allowed.