Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Fatal error: Class 'PDO' not found

PHP Fatal error:  Class 'PDO' not found in /home/bd/public_html/app/webroot/Cake/Model/Datasource/Database/Mysql.php on line 177 

PHP INFO:

PDO  PDO support => enabled PDO drivers => sqlite, sqlite2, mysql  pdo_mysql  PDO Driver for MySQL => enabled Client API version => 5.5.24  Directive => Local Value => Master Value pdo_mysql.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock  pdo_sqlite  PDO Driver for SQLite 3.x => enabled SQLite Library => 3.7.7.1 

PHP INI:

extension=pdo.so extension=pdo_sqlite.so extension=sqlite.so extension=pdo_mysql.so 

CODE:

/**  * Check whether the MySQL extension is installed/loaded  *  * @return boolean  */         public function enabled() {                 return in_array('mysql', PDO::getAvailableDrivers());         } 

Ideas as to why I'm getting this error?

PHP 5.3.15 CloudLinux/CentOS 6 CPanel

like image 387
Amanada Smith Avatar asked Aug 05 '12 01:08

Amanada Smith


People also ask

How do I install PDO drivers?

Pdo ( Portable Data Object ) needs to be installed if it is not done before. For windows platform go to control panel > Add remove program ( or Programs and features ) > Select your PHP installation and click Change. If you are installing PHP fresh then in the setup wizard you can select PDO from Extensions link.

What do you mean by PDO?

Protected Denomination of Origin: a geographical indication defined within European Union law in order to protect regional agricultural products and foodstuffs. Collins English Dictionary. Copyright © HarperCollins Publishers.


2 Answers

try

 yum install php-pdo  yum install php-pdo_mysql   service httpd restart 
like image 125
Bảo Nam Avatar answered Sep 24 '22 06:09

Bảo Nam


Try adding use PDO; after your namespace or just before your class or at the top of your PHP file.

like image 33
Jo Smo Avatar answered Sep 22 '22 06:09

Jo Smo