Switching from PHP74 to 8.0 causes file uploading problem

Service provider is closing the support for PHP 7.4 by the end of this month. Omeka Classic is version 3.0.2 installed via Installatron.

When starting to use PHP 8.0 instead of 7.4 seems to be working fine except one big failure: when uploading a file (image) results in error (see picture). Tried with different file sizes and seems that error is caused when uploading has been finished and something is going to be done with it.

Backcround path info has been updated to point to the right version of PHP.

So, I have understood that this version of Omeka should be compatible with PHP 8.0 but something fails, what?

I’ll just repeat my post from the other thread:

For a “white screen” 500 error, this usually means a fatal PHP error is occurring. If PHP is set up to log on your server (it usually is) then the PHP logs should contain the relevant error. Depending on your server setup, PHP’s logs might go to Apache’s error log, to a dedicated log file, or elsewhere.

As another option, you can enable error display which should replace the white screen with a listing of the error message.

You may be able to ask your host for help in finding PHP error logs on the server, if necessary.

Ok. This is the error output received when trying to save a record with a file (works well if no file uploaded).

Warning : is_readable(): open_basedir restriction in effect. File(/Ghost/Validate/Identical.php) is not within the allowed path(s): (/home/kinxuvyqpa/:/tmp/:/var/tmp/:/usr/local/php80/lib/:/usr/local/php54/lib/:/usr/local/php55/lib/:/usr/local/php56/lib/:/usr/local/php70/lib/:/usr/local/php71/lib/:/usr/local/php72/lib/:/usr/local/lib/php/) in /home/kinxuvyqpa/domains/punkmuseo.fi/public_html/arkisto/application/libraries/Zend/Loader.php on line 186

Warning : is_readable(): open_basedir restriction in effect. File(/Omeka/Validate/Identical.php) is not within the allowed path(s): (/home/kinxuvyqpa/:/tmp/:/var/tmp/:/usr/local/php80/lib/:/usr/local/php54/lib/:/usr/local/php55/lib/:/usr/local/php56/lib/:/usr/local/php70/lib/:/usr/local/php71/lib/:/usr/local/php72/lib/:/usr/local/lib/php/) in /home/kinxuvyqpa/domains/punkmuseo.fi/public_html/arkisto/application/libraries/Zend/Loader.php on line 186

Warning : is_readable(): open_basedir restriction in effect. File(/Ghost/Validate/NotEmpty.php) is not within the allowed path(s): (/home/kinxuvyqpa/:/tmp/:/var/tmp/:/usr/local/php80/lib/:/usr/local/php54/lib/:/usr/local/php55/lib/:/usr/local/php56/lib/:/usr/local/php70/lib/:/usr/local/php71/lib/:/usr/local/php72/lib/:/usr/local/lib/php/) in /home/kinxuvyqpa/domains/punkmuseo.fi/public_html/arkisto/application/libraries/Zend/Loader.php on line 186

Warning : is_readable(): open_basedir restriction in effect. File(/Omeka/Validate/NotEmpty.php) is not within the allowed path(s): (/home/kinxuvyqpa/:/tmp/:/var/tmp/:/usr/local/php80/lib/:/usr/local/php54/lib/:/usr/local/php55/lib/:/usr/local/php56/lib/:/usr/local/php70/lib/:/usr/local/php71/lib/:/usr/local/php72/lib/:/usr/local/lib/php/) in /home/kinxuvyqpa/domains/punkmuseo.fi/public_html/arkisto/application/libraries/Zend/Loader.php on line 186

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

The error here is that the function “escapeshellarg” is not defined. That’s a standard PHP function so I think you’re going to need to talk to your host about that. It’s possible they’ve disabled it purposely, but this isn’t quite the typical behavior when hosts disable functions.

Thanks.

I have to say that I’m a bit confused:

  • We started our project with omeka.net
  • We did install (via Installatron) Omeke on our service providers shared services (PHP 7.4)
  • We started to use this local installation, no problems
  • When we wanted to transfer data from omeka.net to our local installation (shared hosting), it did not work because escapeshellarg was disabled (I posted here about that in last June), and some other functions needed to transfer data via API
  • Our service provider provided us fresh machine, we being first one there and enabling all functions so we can transfer data via API
  • That went fine and then they disabled bunch of functions (and I expect that escapeshellarg too, cannot be sure about hat…)
  • And we continued to use Omeka normally…

And now when changing to PHP 8 things (=uploading files) does not work anymore…

So, escapeshellarg has been working with PHP 7.4 but not with 8. But not with API import. When thinking what we have done and how we have used Omeka, I’m wondering if service provider has really disabled this function for 7.4 at all (even this special arrangement with API transfer refers to that they have) but has done it now for 8.0.

OR, is it possible that there’s some changes with the utilities (imagick or some others) doing thumbnaisl etc. in PHP 8?

OR, is there any workarounds how to bypass this function, which is just adding single quotes… cannot it be done without that function?

Anyway, a bit confused here as everything is not logical, at least based on the information what we have…

Have asked about this from service provider too, lets see what kind of reply we’ll get from them…

OK, so I believe the change here is just that disabled_functions in PHP 8 acts differently, so it’s a “harsher” error than before. I’ll do some thinking about how to account for that, though our general guidance is to use hosting that doesn’t disable functions.

As for workarounds, you could try to comment out (put two slashes, // at the start of the line) the following lines:

  • line 311 of application/models/File.php
  • line 74 of application/libraries/Omeka/File/MimeType/Detect.php

Commenting those should remove the uses of escapeshellarg and similar functions from what’s run when uploading a file.

Thanks. We’ll try workarounds, if needed, when our service provider gets back to us about the situation as for the longer run, it is better to have as standard solution as possible. I’ll keep you updated too.

haven’t heard from service provider yet but those workarounds did the trick. Thanks!

Good to hear. We should be able to integrate a fix for this issue so that there isn’t an error like this if the execution functions are disabled.