[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] At least show an error if the mysql driver isn't available to PHP

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6970e1ed23ed1_2c182dd8629aa@gitlab-sidekiq-low-urgency-cpu-bound-v2-867f88b8bf-p6lln.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
275e5fd7 by Benoit Grégoire at 2026-01-21T14:15:48+00:00
[ENH]  At least show an error if the mysql driver isn't available to PHP
---
* [ENH]  At least show an error if the mysql driver isn't available to PHP

See merge request tikiwiki/tiki!9383

- - - - -


1 changed file:

- lib/core/TikiDb/Initializer.php


Changes:

=====================================
lib/core/TikiDb/Initializer.php
=====================================
@@ -37,11 +37,22 @@ class TikiDb_Initializer
         }
     }
 
-    private function getInitializer()
+    private function getInitializer(): TikiDb_Initializer_Pdo
     {
         $connector = new TikiDb_Initializer_Pdo();
         if ($connector->isSupported()) {
             return $connector;
+        } else {
+            header('HTTP/1.0 503 Service Unavailable', true, 503);
+            echo tr("PDO connector isn't available, and is the only one supported by Tiki.  Check if the PDO php module and PHP mysql driver is available");
+            /*
+            Dying here isn't great, but previously no error was seen because
+            tiki-db.php has a catch all error handler, and does not pass errors to the "Lost database connection" template.
+            Nor do we get the actual error from lower in the code.
+            And you cannot use tiki-check.php either if the mysql driver isn't available to php, so...
+            TODO:  Refactor db error handling so the connection error is actually seen from tiki-install, tiki-check, and tiki in general.  - benoitg - 2026-01-20
+            */
+            die(1);
         }
     }
 }



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/275e5fd7a30c8628308062e954ae0895adcdc084

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/275e5fd7a30c8628308062e954ae0895adcdc084
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.