Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDO doesn't recognise mysql string (SYNC_DB) #2

Open
irreleph4nt opened this issue May 19, 2019 · 0 comments
Open

PDO doesn't recognise mysql string (SYNC_DB) #2

irreleph4nt opened this issue May 19, 2019 · 0 comments

Comments

@irreleph4nt
Copy link

irreleph4nt commented May 19, 2019

Trying to move to mysql and away from sqlite, I found that the current implementation doesn't work. The constructor in lib/KopaanoSyncStates.php does not recognise the PDO string, causing php-fpm to crashdump and webbrowsers to display a HTTP 500 / page not operational error.

The journal shows this when you try to access kdav:

Mai 19 02:14:01 mx1 systemd[1]: Started A high performance web server and a reverse proxy server.
Mai 19 02:14:16 mx1 nginx[1997]: 2019/05/19 02:14:16 [error] 1999#1999: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  date(): Invalid date.timezone value 'Europe\Berlin', we selected the timezone 'UTC' for now. in /usr/share/webapps/kopano-kdav/vendor/apache/log4php/src/main/php/pattern/LoggerPatternConverterDate.php on line 74PHP message: PHP Warning:  date(): Invalid date.timezone value 'Europe\Berlin', we selected the timezone 'UTC' for now. in /usr/share/webapps/kopano-kdav/vendor/apache/log4php/src/main/php/pattern/LoggerPatternConverterDate.php on line 74PHP message: PHP Warning:  date(): Invalid date.timezone value 'Europe\Berlin', we selected the timezone 'UTC' for now. in /usr/share/webapps/kopano-kdav/vendor/apache/log4php/src/main/php/pattern/LoggerPatternConverterDate.php on line 74PHP message: PHP Warning:  date(): Invalid date.timezone value 'Europe\Berlin', we selected the timezone 'UTC' for now. in /usr/share/webapps/kopano-kdav/vendor/apache/log4php/src/main/php/pattern/LoggerPatternConverterDate.php on line 74PHP message: PHP Warning:  date(): Invalid date.timezone value 'Europe\Berlin', we selected the timezone 'UTC' for now. in /usr/share/webapps/kopano-kdav/vendor/apache/log4php/src/main/php/pattern/LoggerPatternConverterDate.php on line 74PHP message: PHP Fatal error:  Uncaught PDOException: could not find driver in /usr/share/webapps/kopano-kdav/lib/KopanoSyncState.php:45
Mai 19 02:14:16 mx1 nginx[1997]: Stack trace:
Mai 19 02:14:16 mx1 nginx[1997]: #0 /usr/share/webapps/kopano-kdav/lib/KopanoSyncState.php(45): PDO->__construct('"mysql:dbname=s...')
Mai 19 02:14:16 mx1 nginx[1997]: #1 /usr/share/webapps/kopano-kdav/lib/KopanoDavBackend.php(48): Kopano\DAV\KopanoSyncState->__construct(Object(Kopano\DAV\KLogger), '"mysql:dbname=s...')
Mai 19 02:14:16 mx1 nginx[1997]: #2 /usr/share/webapps/kopano-kdav/server.php(54): Kopano\DAV\KopanoDavBackend->__construct(Object(Kopano\DAV\KLogger))
Mai 19 02:14:16 mx1 nginx[1997]: #3 {main}
Mai 19 02:14:16 mx1 nginx[1997]:   thrown in /usr/share/webapps/kopano-kdav/lib/KopanoSyncState.php on line 45" while reading response header from upstream, client: 78.94.14.198, server: dav.maerz.cc, request: "GET /server.php HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/webapp.sock

When the error is thrown, config.php reads this:

define('SYNC_DB', '"mysql:dbname=sabredav","user","pass"');

I have also tried this with the same result:

define('SYNC_DB', "'mysql:dbname=sabredav;host=localhost', 'user', 'pass'");
define('SYNC_DB', "mysql:dbname=sabredav;unix_socket=/run/mysqld/mysqld.sock");

The ugly workaround is to hard-code $dbstring in lib/KopanoSyncState.php with the same string as shown above - working perfectly fine:

    public function __construct($logger, $dbstring) {
        $this->logger = $logger;
        $this->logger->trace("Using db %s", $dbstring);
        // $this->db = new \PDO($dbstring);
        $this->db = new \PDO('mysql:dbname=sabredav','user','pass');

Which is also documented upstream in the official sabredav documentation found at:
http://sabre.io/dav/authentication/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant