Occ not working anymore

Steps to reproduce

  1. sudo -u apache /usr/bin/php /var/www/html/owncloud/occ

Expected behaviour

see occ output

Actual behaviour

An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /var/www/html/owncloud/lib/private/DB/Connection.php:62
Stack trace:
#0 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(422): OC\DB\Connection->connect()
#1 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(382): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(324): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(685): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/html/owncloud/lib/private/DB/Connection.php(144): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(195): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /var/www/html/owncloud/lib/private/DB/ConnectionFactory.php(134): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /var/www/html/owncloud/lib/private/Server.php(533): OC\DB\ConnectionFactory->getConnection(‘mysql’, Array)
#8 /var/www/html/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC{closure}(Object(OC\Server))
#9 /var/www/html/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet(‘DatabaseConnect…’)
#10 /var/www/html/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query(‘DatabaseConnect…’)
#11 /var/www/html/owncloud/lib/private/Server.php(1221): OC\ServerContainer->query(‘DatabaseConnect…’)
#12 /var/www/html/owncloud/lib/private/Server.php(407): OC\Server->getDatabaseConnection()
#13 /var/www/html/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC{closure}(Object(OC\Server))
#14 /var/www/html/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet(‘AppConfig’)
#15 /var/www/html/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query(‘AppConfig’)
#16 /var/www/html/owncloud/lib/private/Server.php(1151): OC\ServerContainer->query(‘AppConfig’)
#17 /var/www/html/owncloud/lib/private/Server.php(588): OC\Server->getAppConfig()
#18 /var/www/html/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC{closure}(Object(OC\Server))
#19 /var/www/html/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet(‘AppManager’)
#20 /var/www/html/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query(‘AppManager’)
#21 /var/www/html/owncloud/lib/private/Server.php(1419): OC\ServerContainer->query(‘AppManager’)
#22 /var/www/html/owncloud/lib/private/legacy/app.php(343): OC\Server->getAppManager()
#23 /var/www/html/owncloud/lib/private/legacy/app.php(107): OC_App::getEnabledApps()
#24 /var/www/html/owncloud/lib/base.php(585): OC_App::loadApps(Array)
#25 /var/www/html/owncloud/lib/base.php(1059): OC::init()
#26 /var/www/html/owncloud/console.php(74): require_once(’/var/www/html/o…’)
#27 /var/www/html/owncloud/occ(11): require_once(’/var/www/html/o…’)
#28 {main}

Server configuration

Operating system:
CentOS 7.9.2009

Web server:
Apache/2.4.6 (CentOS)

Database:
mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64)

PHP version:
PHP 7.3.27 (cli)

ownCloud version: (see ownCloud admin page)
10.4.1.3

Updated from an older ownCloud or fresh install:
updated from older 10.x.x version

The content of config/config.php:
<?php
$CONFIG = array (
‘instanceid’ => ‘xxx’,
‘passwordsalt’ => ‘xxx’,
‘secret’ => ‘xxx’,
‘trusted_domains’ =>
array (
0 => ‘mydomain.com’,
),
‘datadirectory’ => ‘/var/www/html/owncloud/data’,
‘overwrite.cli.url’ => ‘https://mydomain.com/owncloud’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘10.4.1.3’,
‘dbname’ => ‘db’,
‘dbhost’ => ‘localhost’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘ocuser’,
‘dbpassword’ => ‘xxx’,
‘logtimezone’ => ‘UTC’,
‘installed’ => true,
‘mail_smtpmode’ => ‘smtp’,
‘mail_from_address’ => ‘alerts’,
‘mail_domain’ => ‘xxx’,
‘mail_smtphost’ => ‘xxx’,
‘mail_smtpport’ => ‘xxx’,
‘mail_smtpsecure’ => ‘tls’,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘mail_smtpauth’ => 1,
‘mail_smtpname’ => ‘xxx’,
‘mail_smtppassword’ => ‘xxx’,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => true,
‘redis’ =>
array (
‘host’ => ‘localhost’,
‘port’ => 6379,
‘timeout’ => 0.0,
),
‘updater.secret’ => ‘xxx’,
‘maintenance’ => false,
‘loglevel’ => 2,
);

Are you using external storage, if yes which one:
no

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one:
no

Message text

Hi everyone,
“occ” command does not work anymore after upgrading to 10.4.1, I realized it now that I’m going to upgrade to 10.5.0.
Server is working fine, clients are working fine, web interface is working fine, I can access my files, clients and server do synchronize, everything is working but “occ” command, which rises an error:

[root@owncloud config]# sudo -u apache /usr/bin/php /var/www/html/owncloud/occ
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /var/www/html/owncloud/lib/private/DB/Connection.php:62

All PHP mandatory modules seem to be installed:

[root@owncloud config]# rpm -qa|grep php73 |sort
php73-2.0-1.el7.remi.x86_64
php73-php-7.3.27-1.el7.remi.x86_64
php73-php-cli-7.3.27-1.el7.remi.x86_64
php73-php-common-7.3.27-1.el7.remi.x86_64
php73-php-devel-7.3.27-1.el7.remi.x86_64
php73-php-gd-7.3.27-1.el7.remi.x86_64
php73-php-gmp-7.3.27-1.el7.remi.x86_64
php73-php-imap-7.3.27-1.el7.remi.x86_64
php73-php-intl-7.3.27-1.el7.remi.x86_64
php73-php-json-7.3.27-1.el7.remi.x86_64
php73-php-ldap-7.3.27-1.el7.remi.x86_64
php73-php-mbstring-7.3.27-1.el7.remi.x86_64
php73-php-mysqlnd-7.3.27-1.el7.remi.x86_64
php73-php-pdo-7.3.27-1.el7.remi.x86_64
php73-php-pdo-dblib-7.3.27-1.el7.remi.x86_64
php73-php-pecl-apcu-5.1.19-1.el7.remi.x86_64
php73-php-pecl-crypto-0.3.1-5.el7.remi.x86_64
php73-php-pecl-igbinary-3.2.1-1.el7.remi.x86_64
php73-php-pecl-imagick-3.4.4-10.el7.remi.x86_64
php73-php-pecl-imagick-devel-3.4.4-10.el7.remi.x86_64
php73-php-pecl-redis4-4.3.0-1.el7.remi.x86_64
php73-php-pecl-xmldiff-1.1.3-1.el7.remi.x86_64
php73-php-pecl-xmldiff-devel-1.1.3-1.el7.remi.x86_64
php73-php-pecl-zip-1.19.2-1.el7.remi.x86_64
php73-php-process-7.3.27-1.el7.remi.x86_64
php73-php-smbclient-1.0.4-1.el7.remi.x86_64
php73-php-xml-7.3.27-1.el7.remi.x86_64
php73-php-xmlrpc-7.3.27-1.el7.remi.x86_64
php73-runtime-2.0-1.el7.remi.x86_64

What can be the issue ? How can I fix it ? Because without occ I can’t maintain and upgrade my owncloud server.
Thanks.

I’d say you lost your db connection.
Could it be that you have different php-versions for /usr/bin/php and the apache server?

I don’t think so, there’s only one php command in the whole server and it is vers. 7.3.27, moreover
on /etc/httpd/conf.d/ there’s only php73-php.conf file.
But how can be possible that the server works fine (file synchronization with clients) while the occ command does not ?? Is there a way to fix it ?

At first I thought:

Is the SQL server still running? Check with systemctl status mariadb
Start it with systemctl start mariadb if it was stopped. If it doesn’t restart you should be able to see the error message when rerunning the above systemctl status .. command.

But then I saw the error message.

and

This definitely indicates that something is wrong with your PHP-CLI environment.

You can run php -i locally and compare the output with the phpinfo-output from a configreport.
When you displayed the installed PHP version, you grepped for a specific version, perhaps you could paste the output without |grep php73, but perhaps with |grep php?

php -m (or was it php -M?) should output the available php modules on the CLI.

Finally you are on CentOS 7, perhaps SELinux is enabled and is blocking access in some kind of way?

Hi Erik, thank you for your reply, I solved the issue !

From the comparison between phpinfo() and “php -i” output I found some differences, the most relevant are the following two:

  1. Additional .ini files are parsed from /etc/opt/remi/php73/php.d/ dir through apache, and from /etc/php.d/ with CLI command;
  2. libraries (*.so) are loaded from /opt/remi/php73/root/usr/lib64/php/modules/ dir in apache, and from /usr/lib64/php/modules/ dir in CLI, even if the common files have the same date and size, of when I updated everything with yum, so both paths seem to be mainteined by yum.

After some trials, the solution was to copy pdo_mysql.so and 30-pdo_mysql.ini in their respective CLI directories. Now the question is: why have they disappeared, since occ has been working for long time before ? But I can be happy as well now. :slight_smile:

Thanks and bye,
S.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.