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

Connection Issue #34

Closed
Vansers opened this issue Jan 8, 2017 · 3 comments
Closed

Connection Issue #34

Vansers opened this issue Jan 8, 2017 · 3 comments

Comments

@Vansers
Copy link

Vansers commented Jan 8, 2017

First of all, I really like how easydb is coded, it's easy and brief than using the actually PDO stuff!

I downloaded easydb with composer, using paragonie/easydb v2.2.1.

I'm just having a weird odd issue right now with easydb connecting, I'm not sure where the issue can be, I checked the SQL server, it appears to be online and running. Using MariaDB 5.5.52.

This is what I used to connect via easydb...

$db = \ParagonIE\EasyDB\Factory::create( 'mysql;host=localhost;dbname=databasename', 'databaseuser', 'databasepw' );

And this is the error it outputted...

Fatal error: Uncaught ParagonIE\EasyDB\Exception\ConstructorFailed: Could not create a PDO connection. Please check your username and password. in /var/www/vhosts/phoenix/httpdocs/area52/system_int/composer/vendor/paragonie/easydb/src/Factory.php:56 Stack trace: #0 /var/www/vhosts/phoenix/httpdocs/area52/system_int/bootstrap.inc.php(67): ParagonIE\EasyDB\Factory::create('mysql;host=loca...', 'databaseuser', 'databasepw') #1 /var/www/vhosts/phoenix/httpdocs/area52/index.php(3): require('/var/www/vhosts...') #2 {main} thrown in /var/www/vhosts/phoenix/httpdocs/area52/system_int/composer/vendor/paragonie/easydb/src/Factory.php on line 56

So I thought it was a error in my credentials, I checked and they were correct, however this wasn't the case after I used straight PDO from PHP and it worked by using this...

$db = new PDO('mysql:host=localhost;dbname=databasename;charset=utf8', 'databaseuser', 'databasepw');

I checked the easydb source code, and I can't figure out what can be the issue. I'm hoping you can help me out here? My PHP version is 7.1.

Thanks!

@Vansers
Copy link
Author

Vansers commented Jan 8, 2017

Okay, that took deep eyes to find the issue. It was an issue with the document in README file.

$db = \ParagonIE\EasyDB\Factory::create( 'mysql;host=localhost;dbname=something', 'username', 'putastrongpasswordhere' );

In the document, it had comma splice (;) after mysql, it should be colon, (:).

@shadowhand
Copy link
Collaborator

Fixed, thanks!

@anant-shah
Copy link

I am having the same issue. Using easydb v2.0.0, php 7.2. i used straight PDO and it is working.
In addition, I am having this site can't be reached error.
Lastly, it shows the username and password in the error which is irritating.

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

No branches or pull requests

3 participants