Omeka_Storage_Exception

Hi,

I've done a new install on a shared server. Everything seems to be working except for image uploads. I can upload other types of files but I get the below error
Omeka_Storage_Exception
Unable to store file
#0 /home/khyber/public_html/omeka2/application/libraries/Omeka/Storage.php(66): Omeka_Storage_Adapter_Filesystem->store('/tmp/fullsize_5...', 'fullsize/58a2bf...')
#1 /home/khyber/public_html/omeka2/application/models/File.php(279): Omeka_Storage->__call(Array, Array)
#2 /home/khyber/public_html/omeka2/application/models/File.php(279): Omeka_Storage->store('store', Array)
#3 /home/khyber/public_html/omeka2/application/models/File/ProcessUploadJob.php(25): File->storeFiles('/tmp/fullsize_5...', 'fullsize/58a2bf...')
#4 /home/khyber/public_html/omeka2/application/libraries/Omeka/Job/Dispatcher/Adapter/Synchronous.php(25): File_ProcessUploadJob->perform()
#5 /home/khyber/public_html/omeka2/application/libraries/Omeka/Job/Dispatcher/Default.php(95): Omeka_Job_Dispatcher_Adapter_Synchronous->send()
#6 /home/khyber/public_html/omeka2/application/models/File.php(70): Omeka_Job_Dispatcher_Default->send('{"className":"F...', Array)
#7 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(282): File->afterInsert('File_ProcessUpl...', Array)
#8 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(561): Omeka_Record->runCallbacks()
#9 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(581): Omeka_Record->save(Array, Array)
#10 /home/khyber/public_html/omeka2/application/models/Item.php(303): Omeka_Record->forceSave('afterInsert')
#11 /home/khyber/public_html/omeka2/application/models/Item.php(239): Item->saveFiles()
#12 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(282): Item->afterSave()
#13 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(566): Omeka_Record->runCallbacks()
#14 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(807): Omeka_Record->save()
#15 /home/khyber/public_html/omeka2/application/libraries/Omeka/Controller/Action.php(419): Omeka_Record->saveForm(Array, Array)
#16 /home/khyber/public_html/omeka2/application/controllers/ItemsController.php(133): Omeka_Controller_Action->addAction('afterSave')
#17 /home/khyber/public_html/omeka2/application/libraries/Zend/Controller/Action.php(516): ItemsController->addAction()
#18 /home/khyber/public_html/omeka2/application/libraries/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch(Array)
#19 /home/khyber/public_html/omeka2/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch()
#20 /home/khyber/public_html/omeka2/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#21 /home/khyber/public_html/omeka2/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run('addAction')
#22 /home/khyber/public_html/omeka2/application/libraries/Omeka/Core.php(165): Zend_Application->run(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#23 /home/khyber/public_html/omeka2/admin/index.php(44): Omeka_Core->run()
#24 {main}

Make sure you've set the permissions for the archive folder and all its subdirectories correctly so the web server can write to them.

If you think the permissions are right, try checking the servers' PHP/Apache logs (or ask your host to look). There could be a weird PHP setting like "safe mode" at play here that's preventing Omeka from copying the files to the archive folder.

I checked the permissions and the PHP/apache logs, and it all seems right. also, I can upload images if Imagemagick is disabled by removing the path in settings. Also any other type of file goes up just fine. exec() is disabled on my server, but they told me to put php.ini files into the directories with the scripts that are giving the errors, but It does not seem to be doing anything. Thanks for any insight you might have

Hmm, exec being disabled would probably account for this.

If that's the case, ImageMagick's simply not creating the thumbnail images, so when we try to move those non-existent images to the archive folder, you get that error.

I don't know your particular server setup though, so your host would still be the best source on if you need to re-enable exec(), and how to do so (or if you can at all).

makes sense. they say they can't re-enable it, but that I could use php.ini files with
disable_functions =

do you think if I placed a php.ini file in each of the directories listed in the error it might work?

so I placed a PHP.ini in all of those directories, and now my imagemagick path says it's broken and I get the below error. pretty mysterious.

Omeka_File_Derivative_Exception

Something went wrong with image creation. Please notify an administrator.

#0 /home/khyber/public_html/omeka2/application/libraries/Omeka/File/Derivative/Image.php(113): Omeka_File_Derivative_Image::createImage('/tmp/ede2fa5227...', '1600', 'fullsize')
#1 /home/khyber/public_html/omeka2/application/libraries/Omeka/File/Derivative/Image.php(222): Omeka_File_Derivative_Image::createDerivativeImages('/tmp/ede2fa5227...')
#2 /home/khyber/public_html/omeka2/application/models/File.php(248): Omeka_File_Derivative_Image::createAll('/tmp/ede2fa5227...', 'image/jpeg')
#3 /home/khyber/public_html/omeka2/application/models/File/ProcessUploadJob.php(24): File->createDerivatives()
#4 /home/khyber/public_html/omeka2/application/libraries/Omeka/Job/Dispatcher/Adapter/Synchronous.php(25): File_ProcessUploadJob->perform()
#5 /home/khyber/public_html/omeka2/application/libraries/Omeka/Job/Dispatcher/Default.php(95): Omeka_Job_Dispatcher_Adapter_Synchronous->send('{"className":"F...', Array)
#6 /home/khyber/public_html/omeka2/application/models/File.php(70): Omeka_Job_Dispatcher_Default->send('File_ProcessUpl...', Array)
#7 [internal function]: File->afterInsert()
#8 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(282): call_user_func_array(Array, Array)
#9 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(561): Omeka_Record->runCallbacks('afterInsert')
#10 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(581): Omeka_Record->save()
#11 /home/khyber/public_html/omeka2/application/models/Item.php(303): Omeka_Record->forceSave()
#12 /home/khyber/public_html/omeka2/application/models/Item.php(239): Item->saveFiles()
#13 [internal function]: Item->afterSave()
#14 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(282): call_user_func_array(Array, Array)
#15 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(566): Omeka_Record->runCallbacks('afterSave')
#16 /home/khyber/public_html/omeka2/application/libraries/Omeka/Record.php(807): Omeka_Record->save()
#17 /home/khyber/public_html/omeka2/application/libraries/Omeka/Controller/Action.php(419): Omeka_Record->saveForm(Array)
#18 /home/khyber/public_html/omeka2/application/controllers/ItemsController.php(133): Omeka_Controller_Action->addAction()
#19 /home/khyber/public_html/omeka2/application/libraries/Zend/Controller/Action.php(516): ItemsController->addAction()
#20 /home/khyber/public_html/omeka2/application/libraries/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('addAction')
#21 /home/khyber/public_html/omeka2/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#22 /home/khyber/public_html/omeka2/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#23 /home/khyber/public_html/omeka2/app

@danielcmatheson

You *should* only need to put the custom php.ini file in the Omeka root directory, but I doubt it will hurt to have it elsewhere as well.

Unfortunately the error messaging in the Image.php script is a bit opaque. I had some success in tracking down particular problems with ImageMagick by editing Image.php to include more details. Check out my final post in this topic for some ways you can get better error messaging. Try it if you are comfortable editing the code.

Specifically you will want to make the exec command output its debugging information where you can log it:

exec($command.' 2>&1', $result_array, $result_value);

The error results for the convert call will be in $result_array, so just throw that into the log when you encounter a failure:

throw new Omeka_File_Derivative_Exception("Tried to run command: \n$command\n\nGot result: \n$result_array[0]\n$result_array[1]");

What I eventually discovered is that 1&1, like other shared hosting providers, has some obscure limits placed around ImageMagick in particular because it's a memory hog. You might have some luck in setting the MAGICK_THREAD_LIMIT to 1, as I described in the thread.

If none of this tells you much, I'd be interested to see what your log output looks like after making the edits above. In my case, the error messages generated by ImageMagick were useful enough I could Google them.

Thanks Aaron, i'm going to give this a shot.

so what i've deduced is that if there's a php.ini file in the "admin" folder it breaks the path to image magick somehow. the error is as below IF i have a php.ini file in the omeka/admin/ directory

convert: UnableToOpenConfigureFile `delegates.xml' @ configure.c/GetConfigureOptions/553.
convert: NoDecodeDelegateForThisImageFormat `/tmp/4c3b97fb9e5f0a7bf0633122bf2b26a0.JPG' @ constitute.c/ReadImage/526.

I tested to see if i was wording something wrong in the php.ini file, but even if the file is empty, the image magick test fails. so mysterious.

but if I don't have the php.ini file in that directory i just get a "can't store file" error.

That looks like a problem with the ImageMagick install. It's basically saying that ImageMagick can't figure out how to deal with that filetype. I can't seem to find the forum topics that dealt with this in the past, but others seemed to fix this by having the service provider reinstall ImageMagick.

Incidentally, you can find out what formats your ImageMagick supports by running:

/path/to/convert -list configure

If your service provider can't or won't reinstall ImageMagick, you might be able to compile a local copy from source using the --prefix flag (set it to someplace you can actually write to, like your home directory).