Bonjour,
Problème qui me rend fou : j'essaie de commencer à coder la partie de mon projet qui va se connecter à une base de donnée que j'ai créée sur MariaDB (que j'ai installé en local).
La BDD en question est accessible avec DBeaver, tout fonctionne.
Sauf que PHP est incapable de fonctionner.
Le code suivant (je ne mets pas tout, vous devez me faire confiance concernant les variables créées en amont) :
Entraîne un message "could not find driver" dans ma page.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 try { $dsn = "mysql:host={$dbHost};dbname={$dbName}"; $pdo = new PDO($dsn, $dbUser, $dbPass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Database connection successful echo "Connected to the database successfully!"; } catch (PDOException $e) { // Log the error, do not expose sensitive details to the user error_log("Database connection error: " . $e->getMessage()); echo $e->getMessage()."<br/>"; die("An error occurred during database connection."); }
Si j'accède à phpinfo() j'ai :
Je viens de passer 1h à chercher des retours de ce problème sur le web,sans succès. Tous ne parlent que d'activer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 PDO support enabled PDO drivers no value
Puis de redémarrer Apache, ce que j'ai fait mais sans succès.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2extension=pdo_mysql extension_dir = "ext"
EDIT :
J'ai une série d'erreur Apache :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Cannot load Zend OPcache - it was built with configuration API420230831,NTS,VS16, whereas running engine is API420230831,TS,VS16 PHP Warning: PHP Startup: bz2: Unable to initialize module\nModule compiled with build ID=API20230831,NTS,VS16\nPHP compiled with build ID=API20230831,TS,VS16\nThese options need to match\n in Unknown on line 0 PHP Warning: PHP Startup: exif: Unable to initialize module\nModule compiled with build ID=API20230831,NTS,VS16\nPHP compiled with build ID=API20230831,TS,VS16\nThese options need to match\n in Unknown on line 0 PHP Warning: PHP Startup: mysqli: Unable to initialize module\nModule compiled with build ID=API20230831,NTS,VS16\nPHP compiled with build ID=API20230831,TS,VS16\nThese options need to match\n in Unknown on line 0 PHP Warning: PHP Startup: pdo_mysql: Unable to initialize module\nModule compiled with build ID=API20230831,NTS,VS16\nPHP compiled with build ID=API20230831,TS,VS16\nThese options need to match\n in Unknown on line 0 PHP Warning: PHP Startup: zip: Unable to initialize module\nModule compiled with build ID=API20230831,NTS,VS16\nPHP compiled with build ID=API20230831,TS,VS16\nThese options need to match\n in Unknown on line 0
Partager