Cannot save or upload a file for an item and cannot upgrade Omeka version

I’m using Omeka Classic ver 3.1. Initially, the error message indicated, among other things, that the Hide Elements plugin was deprecated. I upgraded the plugin accordingly. However, the issue persisted—I was still unable to save or upload pdf files. I then upgraded the other plugins with available new versions, except for the Item Order plugin, since its latest release requires Omeka 3.2 while my site is running on Omeka 3.1. Despite these updates, the problem remains unresolved. The following error appears:

Fatal error: Uncaught Error: Call to undefined function shell_exec() in /home/csguideo/public_html/application/libraries/Omeka/File/MimeType/Detect/Strategy/FileCommand.php:23 Stack trace: 
#0 /home/csguideo/public_html/application/libraries/Omeka/File/MimeType/Detect.php(101): Omeka_File_MimeType_Detect_Strategy_FileCommand->detect('/tmp/phpnA3cc6') 
#1 /home/csguideo/public_html/application/libraries/Omeka/Validate/File/MimeType.php(70): Omeka_File_MimeType_Detect->detect() 
#2 /home/csguideo/public_html/application/libraries/Zend/File/Transfer/Adapter/Abstract.php(673): Omeka_Validate_File_MimeType->isValid('/tmp/phpnA3cc6', Array) 
#3 /home/csguideo/public_html/application/libraries/Zend/File/Transfer/Adapter/Http.php(148): Zend_File_Transfer_Adapter_Abstract->isValid('file_0_') 
#4 /home/csguideo/public_html/application/libraries/Zend/File/Transfer/Adapter/Http.php(159): Zend_File_Transfer_Adapter_Http->isValid('file_0_') 
#5 /home/csguideo/public_html/application/libraries/Omeka/File/Ingest/Upload.php(89): Zend_File_Transfer_Adapter_Http->receive('file_0_') 
#6 /home/csguideo/public_html/application/libraries/Omeka/File/Ingest/AbstractIngest.php(176): Omeka_File_Ingest_Upload->_transferFile(Array, 'CSCMCNo01s2026 ...') 
#7 /home/csguideo/public_html/application/models/Builder/Item.php(201): Omeka_File_Ingest_AbstractIngest->ingest('file') 
#8 /home/csguideo/public_html/application/libraries/globals.php(567): Builder_Item->addFiles('Upload', 'file', Array) 
#9 /home/csguideo/public_html/application/models/Item.php(323): insert_files_for_item(Object(Item), 'Upload', 'file', Array) 
#10 /home/csguideo/public_html/application/models/Item.php(233): Item->_uploadFiles() 
#11 /home/csguideo/public_html/application/libraries/Omeka/Record/AbstractRecord.php(281): Item->beforeSave(Array) 
#12 /home/csguideo/public_html/application/libraries/Omeka/Record/AbstractRecord.php(530): Omeka_Record_AbstractRecord->runCallbacks('beforeSave', Array) 
#13 /home/csguideo/public_html/application/libraries/Omeka/Controller/AbstractActionController.php(236): Omeka_Record_AbstractRecord->save(false) 
#14 /home/csguideo/public_html/application/controllers/ItemsController.php(88): Omeka_Controller_AbstractActionController->editAction() 
#15 /home/csguideo/public_html/application/libraries/Zend/Controller/Action.php(516): ItemsController->editAction() 
#16 /home/csguideo/public_html/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('editAction') 
#17 /home/csguideo/public_html/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) 
#18 /home/csguideo/public_html/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(106): Zend_Controller_Front->dispatch() 
#19 /home/csguideo/public_html/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run() 
#20 /home/csguideo/public_html/application/libraries/Omeka/Application.php(73): Zend_Application->run() 
#21 /home/csguideo/public_html/admin/index.php(28): Omeka_Application->run() 
#22 {main} thrown in /home/csguideo/public_html/application/libraries/Omeka/File/MimeType/Detect/Strategy/FileCommand.php on line 23```

The hosting service provider tried to upgrade or update Omeka in my site but the upgrade failed with the following error:

SQL error in migration: Mysqli statement execute error : Duplicate key name 'modified'

Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate key name 'modified' in /home/csguideo/public_html/application/libraries/Zend/Db/Statement/Mysqli.php:215
Stack trace:
#0 /home/csguideo/public_html/application/libraries/Zend/Db/Statement.php(303): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/csguideo/public_html/application/libraries/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#2 /home/csguideo/public_html/application/libraries/Omeka/Db.php(80): Zend_Db_Adapter_Abstract->query('ALTER TABLE ome...')
#3 /home/csguideo/public_html/application/migrations/20240713211400_updateSessionsTable.php(18): Omeka_Db->__call('query', Array)
#4 /home/csguideo/public_html/application/libraries/Omeka/Db/Migration/Manager.php(232): updateSessionsTable->up()
#5 /home/csguideo/public_html/application/libraries/Omeka/Db/Migration/Manager.php(111): Omeka_Db_Migration_Manager->_migrateUp(Object(DateTime))
#6 /home/csguideo/public_html/application/controllers/UpgradeController.php(44): Omeka_Db_Migration_Manager->migrate()
#7 /home/csguideo/public_html/application/libraries/Zend/Controller/Action.php(516): UpgradeController->migrateAction()
#8 /home/csguideo/public_html/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('migrateAction')
#9 /home/csguideo/public_html/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#10 /home/csguideo/public_html/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(106): Zend_Controller_Front->dispatch()
#11 /home/csguideo/public_html/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#12 /home/csguideo/public_html/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#13 /home/csguideo/public_html/admin/index.php(28): Omeka_Application->run()
#14 {main}

I have a couple comments here:

  • The error happens because your host has disabled the function shell_exec. If they enable it, the problem won’t happen. Some hosts will do this, and some won’t.
  • That disabled function leading to an error is a problem we fixed in version 3.1.1: updating to that version (or better, 3.1.2, the most recent 3.1 version) should fix the problem but not require you to do the database upgrade you’re having trouble with.
  • The upgrade to 3.2 shouldn’t be a problem either: the error message indicates that your omeka_sessions table unexpectedly already had the upgrade applied, essentially. I’m not sure if that stems from a manual change to the database, or a previous partial/incomplete upgrade, but it shouldn’t be too much trouble to move past:
    • The simplest option is, they (or you, if you’re comfortable editing the database) can mark that step of the upgrade complete by inserting a row with the value 20240713211400 to the table omeka_schema_migrations. This will tell Omeka that the omeka_sessions table is already upgraded so we won’t try to do this step again when upgrading.
    • There are only two more steps to the 3.2 database upgrade: I’d probably look at those tables just to check if they look as expected or not just in case: the password column in the omeka_users table should have a length of 40 (the upgrade extends this to 255), and the omeka_files table should not have a column called alt_text (the upgrade adds that column). If that’s all right, then the upgrade should be just fine if rerun after addressing the sessions table problem from the previous point.

Also: not a big deal, but I’m moving this post to the Omeka Classic Troubleshooting forum. “Forum Feedback” is for posts talking about this forum website itself.