holyhope / lti-wims

LTI Interface for Wims LMS
0 stars 0 forks source link

Fatal error: Uncaught PDOException #11

Open Badatos opened 7 years ago

Badatos commented 7 years ago

Bonjour, Je viens de tester l'installation (via docker), et je rencontre l'erreur suivante lorsque je tente d'accéder à http://localhost (container lti-wims) :

Fatal error: Uncaught PDOException: could not find driver in /var/www/classes/DatabaseSession.php:10 Stack trace: 
#0 /var/www/classes/DatabaseSession.php(10): PDO->__construct('postgres:host=l...', 'lti', 'myPassword') 
#1 /var/www/classes/DatabaseSession.php(22): LTI\DatabaseSession->__construct('postgres', 'localhost', '5432', 'wims_lti', 'lti', 'myPassword', '') 
#2 /var/www/Router.php(24): LTI\DatabaseSession::from_config() 
#3 /var/www/html/index.php(9): LTI\Router->handle_request(Array, Array) 
#4 {main} thrown in /var/www/classes/DatabaseSession.php on line 10

Je dispose d'un container postgres running sur le port 5432, comme indiqué dans la doc.

Badatos commented 7 years ago

Eventuellement, voici quelques erreurs (en rouge) que j'ai eu lors du docker build -t lti-wims [...] debconf: delaying package configuration, since apt-utils is not installed

[...]

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20160303/
Installing header files:          /usr/local/include/php/
Installing PDO headers:           /usr/local/include/php/ext/pdo/

warning: pdo (pdo.so) is already loaded!

[...]

Composer (version 1.4.2) successfully installed to: /var/www/html/composer.phar
Use it: php composer.phar

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing mustache/mustache (v2.11.1): Downloading (100%)         
Writing lock file
Generating autoload files

[...]

Removing intermediate container 2c36ea5e42bd
Successfully built 372749687566
Successfully tagged lti-wims:latest
holyhope commented 7 years ago

C'est à cause du driver, j'ai inscrit dans le readme postgres alors qu'il s'appelle pgsql : http://php.net/manual/en/ref.pdo-pgsql.connection.php

Les lignes « en rouge » sont les sorties stderr, il ne s’agit normalement « que » de warning.

debconf: delaying package configuration, since apt-utils is not installed

apt-utils n'est pas installé pour laisser le docker le plus léger possible. Il faut voir si cela nous bloque dans le développement par la suite.

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20160303/
Installing header files:          /usr/local/include/php/
Installing PDO headers:           /usr/local/include/php/ext/pdo/

warning: pdo (pdo.so) is already loaded!

PDO est installé en utilisant les scripts de l'image docker PHP : https://hub.docker.com/_/php/

Composer (version 1.4.2) successfully installed to: /var/www/html/composer.phar
Use it: php composer.phar

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing mustache/mustache (v2.11.1): Downloading (100%)         
Writing lock file
Generating autoload files

composer est lancé en tant que root car le système n'a pas d'autre utilisateur (le webserver est également lancé en tant que root).

Removing intermediate container 2c36ea5e42bd
Successfully built 372749687566
Successfully tagged lti-wims:latest

Super, ça a fonctionné !

Badatos commented 7 years ago

J'ai renommé "postgres" en "pgsql" dans config.php, mais l'erreur ne semble pas avoir changé :

Fatal error: Uncaught PDOException: could not find driver in /var/www/classes/DatabaseSession.php:10 Stack trace:
#0 /var/www/classes/DatabaseSession.php(10): PDO->__construct('pgsql:host=loca...', 'lti', 'myPassword')
#1 /var/www/classes/DatabaseSession.php(22): LTI\DatabaseSession->__construct('pgsql', 'localhost', '5432', 'wims_lti', 'lti', 'myPassword', '')
#2 /var/www/Router.php(24): LTI\DatabaseSession::from_config()
#3 /var/www/html/index.php(9): LTI\Router->handle_request(Array, Array)
#4 {main} thrown in /var/www/classes/DatabaseSession.php on line 10