Error in Cron job: Class OC\Session\Memory not found

While trying to solve a different issue, I happened to note that OwnCloud is complaining that its Cron-job hasn’t run in a long time. If I try running cron.php manually, after some deprecation notices, I receive the error:

During inheritance of ArrayAccess: Uncaught Error: Class "OC\Session\Memory" not found

OwnCloud is otherwise running fine. FWIW, I’m just a user of OwnCloud, not a developer, so be gentle :slight_smile: Should it be helpful, here is the complete stack trace:

/usr/bin/php -f /var/www/owncloud/cron.php 
PHP Deprecated:  Return type of OC\Memcache\Cache::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/owncloud/lib/private/Memcache/Cache.php on line 81
PHP Deprecated:  Return type of OC\Memcache\Cache::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/owncloud/lib/private/Memcache/Cache.php on line 89
PHP Deprecated:  Return type of OC\Memcache\Cache::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/owncloud/lib/private/Memcache/Cache.php on line 85
PHP Deprecated:  Return type of OC\Memcache\Cache::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/owncloud/lib/private/Memcache/Cache.php on line 93
PHP Fatal error:  During inheritance of ArrayAccess: Uncaught Error: Class "OC\Session\Memory" not found in /var/www/owncloud/lib/private/Server.php:323
Stack trace:
#0 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC\{closure}()
#1 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet()
#2 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query()
#3 /var/www/owncloud/lib/private/Server.php(1123): OC\ServerContainer->query()
#4 /var/www/owncloud/lib/private/Server.php(1130): OC\Server->getUserSession()
#5 /var/www/owncloud/lib/private/Server.php(820): OC\Server->getSession()
#6 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC\{closure}()
#7 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet()
#8 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query()
#9 /var/www/owncloud/lib/private/Server.php(1614): OC\ServerContainer->query()
#10 /var/www/owncloud/lib/private/Server.php(728): OC\Server->getCsrfTokenManager()
#11 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC\{closure}()
#12 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet()
#13 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query()
#14 /var/www/owncloud/lib/private/Server.php(988): OC\ServerContainer->query()
#15 /var/www/owncloud/lib/private/Log/Owncloud.php(88): OC\Server->getRequest()
#16 /var/www/owncloud/lib/private/Log/Owncloud.php(67): OC\Log\Owncloud::writeExtra()
#17 /var/www/owncloud/lib/private/Log.php(401): OC\Log\Owncloud::write()
#18 /var/www/owncloud/lib/private/Log.php(210): OC\Log->log()
#19 /var/www/owncloud/lib/private/Log/ErrorHandler.php(78): OC\Log->error()
#20 /var/www/owncloud/lib/private/Session/Session.php(28): OC\Log\ErrorHandler::onError()
#21 /var/www/owncloud/lib/composer/composer/ClassLoader.php(444): include('...')
#22 /var/www/owncloud/lib/composer/composer/ClassLoader.php(322): Composer\Autoload\includeFile()
#23 /var/www/owncloud/lib/private/Session/Memory.php(39): Composer\Autoload\ClassLoader->loadClass()
#24 /var/www/owncloud/lib/composer/composer/ClassLoader.php(444): include('...')
#25 /var/www/owncloud/lib/composer/composer/ClassLoader.php(322): Composer\Autoload\includeFile()
#26 /var/www/owncloud/lib/private/Server.php(323): Composer\Autoload\ClassLoader->loadClass()
#27 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC\{closure}()
#28 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet()
#29 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query()
#30 /var/www/owncloud/lib/private/Server.php(1123): OC\ServerContainer->query()
#31 /var/www/owncloud/lib/private/Server.php(614): OC\Server->getUserSession()
#32 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC\{closure}()
#33 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet()
#34 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query()
#35 /var/www/owncloud/lib/private/Server.php(1458): OC\ServerContainer->query()
#36 /var/www/owncloud/lib/private/legacy/app.php(344): OC\Server->getAppManager()
#37 /var/www/owncloud/lib/private/legacy/app.php(108): OC_App::getEnabledApps()
#38 /var/www/owncloud/lib/base.php(591): OC_App::loadApps()
#39 /var/www/owncloud/lib/base.php(1071): OC::init()
#40 /var/www/owncloud/cron.php(34): require_once('...')
#41 {main} in /var/www/owncloud/lib/private/Session/Session.php on line 28

Since you didn’t drop a single line about your environment my crystal ball says you have got either

  • outdated ownCloud
  • outdated PHP
  • different PHP versions for your webserver and command line

or all of that.

1 Like

Thanks for the idea. It looks like your 3rd idea is right: the command-line php is 8.1, but Apache and OwnCloud are using 7.3. Changing the command-line version to 7.3 seems to have resolved the problem.

1 Like