Nextcloud 23.0.2 - cron.php and OCC dont work

Hi,

yesterday I installed nextcloud 23.0.2. Everything works except the cron.php and occ.
If I try to start the cronjob with:

sudo -u http php /volume1/web/nextcloud/cron.php

I get the following errors:

Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: could not find driver in /volume1/web/nextcloud/lib/private/DB/Connection.php:87
Stack trace:
#0 /volume1/web/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1519): OC\DB\Connection->connect()
#1 /volume1/web/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1041): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /volume1/web/nextcloud/lib/private/DB/Connection.php(237): Doctrine\DBAL\Connection->executeQuery(‘SELECT * FROM ...', Array, Array, NULL) #3 /volume1/web/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery('SELECT * FROM …’, Array, Array)
#4 /volume1/web/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /volume1/web/nextcloud/lib/private/AppConfig.php(344): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /volume1/web/nextcloud/lib/private/AppConfig.php(109): OC\AppConfig->loadConfigValues()
#7 /volume1/web/nextcloud/lib/private/AppConfig.php(300): OC\AppConfig->getApps()
#8 /volume1/web/nextcloud/lib/private/legacy/OC_App.php(972): OC\AppConfig->getValues(false, ‘installed_versi…’)
#9 /volume1/web/nextcloud/lib/private/Server.php(692): OC_App::getAppVersions()
#10 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC{closure}(Object(OC\Server))
#11 /volume1/web/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(Pimple\Container))
#12 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet(‘OC\Memcache\Fac…’)
#13 /volume1/web/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query(‘OC\Memcache\Fac…’, false)
#14 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query(‘OC\Memcache\Fac…’)
#15 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(182): OC\AppFramework\Utility\SimpleContainer->get(‘OC\Memcache\Fac…’)
#16 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(OC\Server))
#17 /volume1/web/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(Pimple\Container))
#18 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet(‘OCP\ICacheFacto…’)
#19 /volume1/web/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query(‘OCP\ICacheFacto…’, false)
#20 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query(‘OCP\ICacheFacto…’)
#21 /volume1/web/nextcloud/lib/private/Server.php(1079): OC\AppFramework\Utility\SimpleContainer->get(‘OCP\ICacheFacto…’)
#22 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC{closure}(Object(OC\Server))
#23 /volume1/web/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(Pimple\Container))
#24 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet(‘OCP\Lock\ILocki…’)
#25 /volume1/web/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query(‘OCP\Lock\ILocki…’, false)
#26 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query(‘OCP\Lock\ILocki…’)
#27 /volume1/web/nextcloud/lib/private/Server.php(2040): OC\AppFramework\Utility\SimpleContainer->get(‘OCP\Lock\ILocki…’)
#28 /volume1/web/nextcloud/lib/private/Files/View.php(118): OC\Server->getLockingProvider()
#29 /volume1/web/nextcloud/lib/private/Server.php(439): OC\Files\View->__construct()
#30 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC{closure}(Object(OC\Server))
#31 /volume1/web/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(Pimple\Container))
#32 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet(‘OC\Files\Node\H…’)
#33 /volume1/web/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query(‘OC\Files\Node\H…’, false)
#34 /volume1/web/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query(‘OC\Files\Node\H…’)
#35 /volume1/web/nextcloud/lib/private/Server.php(1403): OC\AppFramework\Utility\SimpleContainer->get(‘OC\Files\Node\H…’)
#36 /volume1/web/nextcloud/lib/base.php(594): OC\Server->boot()
#37 /volume1/web/nextcloud/lib/base.php(1087): OC::init()
#38 /volume1/web/nextcloud/cron.php(43): require_once(’/volume1/web/ne…’)
#39 {main}

Nextcloud run on a Synology NAS, DSM 7.0.1-42218 Update 2.

I get the same error when I try to start a occ command, eg. php occ db:add-missing-indices.

Have somebody an idea what the problem is?

Thank you.

Is http the real owner of your nextcloud directory?
The occ command has to run as that user too. Does this work:
sudo -u http php occ db:add-missing-indices
when /volume1/web/nextcloud is your current directory?
Can you access the database manually with the credentials that are in config.php?

Hi eehmke,

Is http the real owner of your nextcloud directory?

Yes, http is the owner of my nextcloud directory.

The occ command has to run as that user too. Does this work:
sudo -u http php occ db:add-missing-indices
when /volume1/web/nextcloud is your current directory?

I get the same error as mentioned above … putty screenshot

Can you access the database manually with the credentials that are in config.php?
Yes, I can.

My config.php:
‘datadirectory’ => ‘/volume1/nextcloud/’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘23.0.2.1’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘127.0.0.1:3307’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => ‘root’,
‘dbpassword’ => ‘Password’,

is the php-mysql package installed? Beside, using the root credentials to access the database is a bad idea. You should define a dedicated user that only can access the nextcloud database.
https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/linux_database_configuration.html

Is 3307 really the port of the MySQL server? The standard port is 3306.

hmm … php-mysql seems not to be on my NAS:
[PHP Modules]
bcmath
bz2
Core
ctype
curl
date
dom
filter
hash
iconv
json
ldap
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
xml
xmlreader
xmlwriter
zip
zlib

I dont know whether its possible to install this package on my Synology? Is that not this package?

Thanks for the hint concerning database user!

Did it work? Could you install the php mysql module?

Not yet. Can’ find a possibility to do this.

Does the synology OS use SELinux? On Rocky Linux I had to specifically allow apache to talk to MariaDB:

setsebool -P httpd_can_network_connect_db 1

Which version of PHP is installed? Do you have MySQL or MariaDB, and which versions?

I have PHP version 7.4.18 and MariaDB 10.3.29 on my NAS.
I tried to reinstall all, also nextcloud 23.0.2. Same error.

Can’t find something like httpd_can_network_connect_db regarding Synology NAS. :frowning:

I had the line:
‘memcache.local’ => ‘\OC\Memcache\APCu’,
in my config.php. If i delete that line and run “sudo -u http php74 /volume1/web/nextcloud/cron.php”
then it works. I thought the APCu line is needet in the config.php?
What is the difference between the command php and php74?

Isn’t Nextcloud 23 supposed to require (I think) PHP8, which is not yet available on DSM7?

No, NC23 works up to php 7.4.

1 Like

Good to know. I thought I was stuck with NC21 until Synology released PHP8 for DSM7. Thank you!