Message in connect to DB

berrutti

New Member
Messages
11
Reaction score
0
Points
1
What is happening here, when a try to connect to my DB?

Fatal error: Uncaught PDOException: could not find driver in /home/wiolxdeu/domains/prbcursos.x10.bz/public_html/Conexao.php:3 Stack trace: #0 /home/wiolxdeu/domains/prbcursos.x10.bz/public_html/Conexao.php(3): PDO->__construct() #1 /home/wiolxdeu/domains/prbcursos.x10.bz/public_html/cabecalho.php(4): require_once('/home/wiolxdeu/...') #2 /home/wiolxdeu/domains/prbcursos.x10.bz/public_html/index.php(5): require_once('/home/wiolxdeu/...') #3 {main} thrown in /home/wiolxdeu/domains/prbcursos.x10.bz/public_html/Conexao.php on line 3

The file Conexao.php has this commands:
$bd = new PDO("mysql:host=localhost; dbname=wiolxdeu_ramiro; charset-UTF8", "wiolxdeu_ramiro", "XXXXXXXXX");
 

berrutti

New Member
Messages
11
Reaction score
0
Points
1
The line 11 is:
$bd = new PDO("mysql:host=localhost; dbname=wiolxdeu_ramiro; charset-UTF8", "wiolxdeu_ramiro", "XXXXXXXXX");
XXXXXXX is my password
 

ctyrd

Active Member
Messages
958
Reaction score
81
Points
28
Maybe syntax, is it $bd = or $db = and extra " marks. Try something like
Code:
$db = new PDO('mysql:host=localhost;dbname='.DBNAME, 'user', 'password');
 

berrutti

New Member
Messages
11
Reaction score
0
Points
1
In my local machine it works.
I only define my local database.
But i'll try it.
 

berrutti

New Member
Messages
11
Reaction score
0
Points
1
It doesn't work.
Same error.
I don't know what is happening.
In my local machine it works (with my local definitions).
 

ctyrd

Active Member
Messages
958
Reaction score
81
Points
28
@berrutti
You'll have to search, Do you have a phpinfo.php file in the public_html dirctory?
Code:
<?php phpinfo();?>

Check for errors in error logs https://prbcursos.x10.bz:2222/

Try enabling "pdo_dblib" and "nd_pdo_mysql"

  • Server: DA PMA Signon (Localhost via UNIX socket)
  • Server type: MariaDB
 
Last edited:

berrutti

New Member
Messages
11
Reaction score
0
Points
1
No, I don't have a phpinfo.php file in the public_html directory.
I'll try to enable "pdo_dblib" but doesn't work.
I'll see the errors log.
 

ctyrd

Active Member
Messages
958
Reaction score
81
Points
28
phpinfo.php can help find the trouble. It is very difficult searching for issues on script written at home, running on a hosting server software.

pdo_mysql.default_socket - /var/lib/mysql/mysql.sock

Check error logs.
 

berrutti

New Member
Messages
11
Reaction score
0
Points
1
I tested it on another provider, 000webhost, and it worked perfectly there. So thanks for the help. In the future I intend to come back and test again here, because I really liked X10hosting, but for now I'm going there. Thank you so much for everything.
 

spacresx

Community Advocate
Community Support
Messages
2,202
Reaction score
195
Points
63
x10 hosting does not provide any script support.
other forum users may offer advice or suggestions if available.

what kind of script is Conexao.php ?
is this part of your x10 settings or is it a 3rd party script ?
 

berrutti

New Member
Messages
11
Reaction score
0
Points
1
It's my php file.
I made it.
<?php
$bd = new PDO("mysql:host=localhost; dbname=wiolxdeu_ramiro; charset-UTF8", "wiolxdeu_ramiro", "XXXXXX");
$bd -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>
I removed the other comments.
he problem line is: $bd = new PDO("mysql:host=localhost; dbname=wiolxdeu_ramiro; charset-UTF8", "wiolxdeu_ramiro", "XXXXXX");

In my index.php at first:
require_once 'Conexao.php';
 
Top