Error in PHP PDO Class

Asked

Viewed 55 times

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" &#xA;extension="pdo_mysql.so""

  • Didn’t work :(

  • Php version and operating system? the aparce extension installed in phpinfo()?

  • 1

    appears yes see at print: http://www.awesomescreenshot.com/image/1297401/3f6302ee54f289987312b44d80211777

  • Put the code you’re using, which means new PDO(...) place from the beginning of the file.

  • @rray see the question, edited putting my connection class.

  • The PDO extension is enabled in your php.ini?

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.