0
Guys I’m trying to use the PDO class in one of my systems and this error is appearing, and the PDO class is already installed.
Fatal error: Class 'PDO' not found in /home/dfmedica/public_html/cursos/classes/BD.class.php on line 9
Connection class:
<?php
class BD{
private static $conn;
public function __construct(){}
public static function conn(){
if(is_null(self::$conn)){
self::$conn = new PDO('mysql:host='.HOST.';dbname='.BD.'', ''.USER.'', ''.PASS.'');
}
return self::$conn;
}
}
?>
OBS: The data of access to the bank are correct, because I have already tested.
Add these two lines to your php.ini: "
extension="pdo.so" 
extension="pdo_mysql.so"
"– Miguel
Didn’t work :(
– David Damasceno
Php version and operating system? the aparce extension installed in phpinfo()?
– rray
appears yes see at print: http://www.awesomescreenshot.com/image/1297401/3f6302ee54f289987312b44d80211777
– David Damasceno
Put the code you’re using, which means
new PDO(...)
place from the beginning of the file.– rray
@rray see the question, edited putting my connection class.
– David Damasceno
The PDO extension is enabled in your php.ini?
– KhaosDoctor