WillyJimmyDev / simple-quiz

A simple quiz administration written in PHP with a MySQL backend. Uses Bootstrap 3 and Slim PHP micro framework
http://elanman.com/simple-quiz/
Apache License 2.0
165 stars 73 forks source link

Uncaught exception 'PDOException' #13

Closed stevejoc closed 9 years ago

stevejoc commented 9 years ago

I get this error: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'quiz'@'localhost' (using password: YES)' in /home/homework/vendor/j4mie/idiorm/idiorm.php:255 Stack trace: #0 /home/homework/vendor/j4mie/idiorm/idiorm.php(255): PDO->__construct('mysql:host=loca...', 'quiz', 'XXXXXXXXXXX...', NULL) #1 /home/homework/vendor/j4mie/idiorm/idiorm.php(237): ORM::_setup_db('default') #2 /home/homework/SimpleQuiz/Utils/Session.php(73): ORM::for_table('sessions') #3 [internal function]: SimpleQuiz\Utils\Session->read('21e19d4772bf669...') #4 /home/homework/SimpleQuiz/Utils/Session.php(22): session_start() #5 /home/homework/public_html/quiz/index.php(14): SimpleQuiz\Utils\Session->__construct() #6 {main} thrown in /home/homework/vendor/j4mie/idiorm/idiorm.php on line 255

I installed this from the SourceForge site. Thanks for any help!

WillyJimmyDev commented 9 years ago

Hi Steve, The MySQL user defined in the SourceForge config.php file is 'quizmaster' but I see the error that you are receiving is trying to connect to MySQL as user 'quiz'. Have you changed the config file? If so, have you also changed the corresponding user in MySQL? How far have you got importing the database etc?

stevejoc commented 9 years ago

Hi Ben,

First off thanks for creating this software and getting back to me. As an Open Educational Resource creator, I can especially appreciate the work that open source software authors like you do.

I realized that I forgot to append the proper database name and user prefix required by cpanel. Once I edited config.php correctly, that error disappeared. After that I had to edit index.php to fix some pathways. Finally, I ended up with this Slim Application error:

https://www.dropbox.com/s/8fyam4p7xnjf2qb/voila_capture%202015-04-05_10-10-54_am.png?dl=0

Undoubtedly, I need to edit another pathway somewhere. I just stuck all the files except the public ones in the root directory below public_html. If you can point me in the right direction that would be great.

I'm brewing beer today, so I will be in and out!

Thanks again for creating open source software—especially software that can be deployed in education

Steve

Sent from my iPad

On Apr 5, 2015, at 4:37 AM, Ben Hall notifications@github.com wrote:

Hi Steve, The MySQL user defined in the SourceForge config.php file is 'quizmaster' but I see the error that you are receiving is trying to connect to MySQL as user 'quiz'. Have you changed the config file? If so, have you also changed the corresponding user in MySQL? How far have you got importing the database etc?

— Reply to this email directly or view it on GitHub.

WillyJimmyDev commented 9 years ago

Hi Steve, If you take a look at the file structure diagram in the README, it might help you. The public folder corresponds to your document root (in your case, public_html?). The other directories sit outside the document root on the same level. I noticed on your error screenshot that you have another directory (quiz) inside your document root. If index.php is inside the quiz directory, it won't be able to find the correct paths for the slim templates etc. Either try moving everything inside the quiz directory one level up the file structure (making the quiz directory obsolete) or move the other directories (vendor, routes etc) to sit inside the public_html directory.

Hope that makes sense (the diagram should help).

wildvald commented 9 years ago

Hi Steve. I had the same problem as you. in you index (in your quiz public_html folder), go to:

$app = new \Slim\Slim(array( 'debug' => true, 'log.enabled' => true, 'templates.path' => 'CHOSE THE CORRECT PATH to YOUR TEMPLATE' ));

My template path was in the directory outside of my public_html. So mine had to be: 'templates.path' => '../../quiz/templates'

Hope it helps