OCC error when called uppon with PHP8.3

Nextcloud version (eg, 20.0.5): 28.0.1
Operating system and version (eg, Ubuntu 20.04): ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): nginx 1.25.3
PHP version (eg, 7.4): Php-8.3
Database: postgres 15.5

The issue you are facing:

I have just switched over from php8.2 to php8.3 pretty successfully. Most everything runs no problem. The only weird thing is when I manually call
occ to run a command. I get the following error. Now I have the php8.3-pgsql module installed and I don’t seem to get constant related errors in the logs. it’s just when I manually call occ. I suspect there must be something obvious I’m forgetting

Is this the first time you’ve seen this error? (Y/N): Y

The output of error:

sudo -u www-data php8.3 ./occ maintenance:repair
An unhandled exception has been thrown:
Error: Class "PDO" not found in /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php:34
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(377): Doctrine\DBAL\Driver\PDO\PgSQL\Driver->connect()
#1 /var/www/nextcloud/lib/private/DB/Connection.php(133): Doctrine\DBAL\Connection->connect()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1654): OC\DB\Connection->connect()
#3 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1081): Doctrine\DBAL\Connection->getWrappedConnection()
#4 /var/www/nextcloud/lib/private/DB/Connection.php(261): Doctrine\DBAL\Connection->executeQuery()
#5 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(337): OC\DB\Connection->executeQuery()
#6 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(377): Doctrine\DBAL\Query\QueryBuilder->executeQuery()
#7 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#8 /var/www/nextcloud/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()
#9 /var/www/nextcloud/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#10 /var/www/nextcloud/lib/private/AppConfig.php(374): OC\AppConfig->getApps()
#11 /var/www/nextcloud/lib/private/legacy/OC_App.php(734): OC\AppConfig->getValues()
#12 /var/www/nextcloud/lib/private/Server.php(681): OC_App::getAppVersions()
#13 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(175): OC\Server->OC\{closure}()
#14 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#15 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(142): Pimple\Container->offsetGet()
#16 /var/www/nextcloud/lib/private/ServerContainer.php(173): OC\AppFramework\Utility\SimpleContainer->query()
#17 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(64): OC\ServerContainer->query()
#18 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(197): OC\AppFramework\Utility\SimpleContainer->get()
#19 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(175): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#20 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#21 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(142): Pimple\Container->offsetGet()
#22 /var/www/nextcloud/lib/private/ServerContainer.php(173): OC\AppFramework\Utility\SimpleContainer->query()
#23 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(64): OC\ServerContainer->query()
#24 /var/www/nextcloud/lib/private/Server.php(1079): OC\AppFramework\Utility\SimpleContainer->get()
#25 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(175): OC\Server->OC\{closure}()
#26 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#27 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(142): Pimple\Container->offsetGet()
#28 /var/www/nextcloud/lib/private/ServerContainer.php(173): OC\AppFramework\Utility\SimpleContainer->query()
#29 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(64): OC\ServerContainer->query()
#30 /var/www/nextcloud/lib/private/Server.php(2037): OC\AppFramework\Utility\SimpleContainer->get()
#31 /var/www/nextcloud/lib/private/Files/View.php(107): OC\Server->getLockingProvider()
#32 /var/www/nextcloud/lib/private/Server.php(470): OC\Files\View->__construct()
#33 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(175): OC\Server->OC\{closure}()
#34 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#35 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(142): Pimple\Container->offsetGet()
#36 /var/www/nextcloud/lib/private/ServerContainer.php(173): OC\AppFramework\Utility\SimpleContainer->query()
#37 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(64): OC\ServerContainer->query()
#38 /var/www/nextcloud/lib/private/Server.php(1447): OC\AppFramework\Utility\SimpleContainer->get()
#39 /var/www/nextcloud/lib/base.php(635): OC\Server->boot()
#40 /var/www/nextcloud/lib/base.php(1200): OC::init()
#41 /var/www/nextcloud/console.php(48): require_once('...')
#42 /var/www/nextcloud/occ(11): require_once('...')
#43 {main}

I have the following php modules installed

php8.3
php8.3-apcu     
php8.3-bcmath
php8.3-bz2
php8.3-cli
php8.3-common 
php8.3-curl  
php8.3-fpm  
php8.3-gd
php8.3-gmp
php8.3-igbinary 
php8.3-imagick 
php8.3-intl
php8.3-mbstring 
php8.3-memcache
php8.3-memcached  
php8.3-msgpack  
php8.3-opcache
php8.3-pgsql
php8.3-readline
php8.3-redis
php8.3-soap
php8.3-xml  
php8.3-zip

Thank you!

You’re missing the pdo_* module for the connector your DB of choice[1].

[1] PHP Modules & Configuration — Nextcloud latest Administration Manual latest documentation

I thought that was php8.3-pgsql for ubuntu?

Does running sudo -u www-data php8.3 -m show pdo_pgsql in it?

If not, your cli-mode php.ini (or equivalent) may not have the same extensions enabled in it that your fpm php.ini does.

Nope it doesn’t, how do I enable that in cli?

[EDIT]

Ahh the plot thickens

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/lib/php/20230831/pdo_pgsql (/usr/lib/php/20230831/pdo_pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20230831/pdo_pgsql.so (/usr/lib/php/20230831/pdo_pgsql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'tidy' (tried: /usr/lib/php/20230831/tidy (/usr/lib/php/20230831/tidy: cannot open shared object file: No such file or directory), /usr/lib/php/20230831/tidy.so (/usr/lib/php/20230831/tidy.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
apcu
Core
date
filter
hash
igbinary
imagick
json
libxml
mbstring
memcache
memcached
msgpack
openssl
pcntl
pcre
pgsql
random
redis
Reflection
session
soap
sodium
SPL
standard
zip
zlib

[Zend Modules]

I didn’t see on the top at first. That’s really odd.

[EDIT 2]

I tried uninstalling and reinstalling php-pgsql and then I noticed this

Creating config file /etc/php/8.3/mods-available/pgsql.ini with new version
Creating config file /etc/php/8.3/mods-available/pdo_pgsql.ini with new version
WARNING: Not enabling the pdo_pgsql module for PHP 8.3 cli SAPI since the module
WARNING: was disabled by local administrator.
WARNING: Not enabling the pdo_pgsql module for PHP 8.3 fpm SAPI since the module
WARNING: was disabled by local administrator.
php_invoke pdo_pgsql: no action - module was disabled by maintainer for PHP 8.3 cli sapi

I think this is my issue. Any Ideas how I can fix that?

[EDIT 4]

I managed to fix that last issue, that was my own doing playing with the php.ini file. But I still can’t seem to get the pdo module to load with cli. same thing as above

Unfortunately the easiest solution for me was to nuke and pave all php libraries particularly php-common which looks to have some of the pdo stuff as well (saving the fpm php.ini file of course) and reinstall everything

not too much work but sure is a pain.

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