Saat menjalankan perintah occ dari command line, muncul error

$ sudo -u www-data php occ
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/html/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
....
#60 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#61 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(116): Pimple\Container->offsetGet('L10NFactory')
#62 /var/www/html/nextcloud/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('L10NFactory')
#63 /var/www/html/nextcloud/lib/private/Server.php(1440): OC\ServerContainer->query('L10NFactory')
#64 /var/www/html/nextcloud/lib/private/Server.php(1451): OC\Server->getL10NFactory()
#65 /var/www/html/nextcloud/lib/base.php(228): OC\Server->getL10N('lib')
#66 /var/www/html/nextcloud/lib/base.php(667): OC::checkConfig()
#67 /var/www/html/nextcloud/lib/base.php(1081): OC::init()
#68 /var/www/html/nextcloud/console.php(46): require_once('/var/www/html/n...')
#69 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')

hal ini terjadi karena saya menjalankan menggunakan php 7.2.

$ php -v
PHP 7.2.8-1+0~20180725124257.2+stretch~1.gbp571e56 (cli) (built: Jul 25 2018 12:43:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.8-1+0~20180725124257.2+stretch~1.gbp571e56, Copyright (c) 1999-2018, by Zend Technologies

di Debian 9 yang saya gunakan terinstall beberapa versi PHP 7.0, 7.1, 7.2. Bisa dicek dengan

dpkg -l | grep php
# atau
update-alternatives --display php
# atau
ls /usr/bin/php*

contoh ls /usr/bin/php*

/usr/bin/php  /usr/bin/php7.0  /usr/bin/php7.1  /usr/bin/php7.2  /usr/bin/php-cgi  /usr/bin/php-cgi7.2

karena nextcloud belum compatible dengan PHP 7.2 saya akan menggunakan PHP 7.1 untuk menjalankan OCC

sudo -u www-data /usr/bin/php7.1 occ

sukses.

Leave a comment

Your email address will not be published. Required fields are marked *