I have a successful NextCloud install (cloned from the git repo). I’m getting an error when I run PHPUnit.
System setup:
OS: Ubuntu 24.04 LTS
which php |
/home/user/.phpbrew/php/php-8.3.10/bin/php |
which phpunit |
/home/user/.phpbrew/php/php-8.3.10/bin/phpunit |
Nextcloud install | /home/user/projects/github/nextcloud/server |
I installed PHPUnit manually from the website and placed it in the directory mentioned above.
When I try to run
$ phpunit --bootstrap ./tests/bootstrap.php apps/settings/tests/Settings/Admin/ServerTest.php
I get this error (relevant portion):
Warning: Module "mysqli" is already loaded in Unknown on line 0
Warning: Module "mysqlnd" is already loaded in Unknown on line 0
PHPUnit 10.5.29 by Sebastian Bergmann and contributors.
Error in bootstrap script: Doctrine\DBAL\Exception:
Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory
#0 /home/user/projects/github/nextcloud/server/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /home/user/projects/github/nextcloud/server/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /home/user/projects/github/nextcloud/server/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /home/user/projects/github/nextcloud/server/3rdparty/doctrine/dbal/src/Connection.php(1320): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /home/user/projects/github/nextcloud/server/lib/private/DB/Connection.php(120): Doctrine\DBAL\Connection->setNestTransactionsWithSavepoints(true)
...
(NOTE: I get those warnings because I’m including extension=mysqlnd
and extension=mysqli
lines in my phpbrew’s php.ini)
I checked and phpbrew has pdo_mysql
installed:
$ phpbrew ext
...
[*] pdo 8.3.10
[*] pdo_mysql 8.3.10
...
Do I have the system configuration correct? is PHPBrew causing the issue?
Thanks!