PHP Fatal error: Class 'PDO' not found

8,926

It may be due to namespace problems in which case you need to escape PDO like:

$indexes = $this->dbh->cubrid_schema(\PDO::CUBRID_SCH_CONSTRAINT, $table->getName());

For more details see this answer https://stackoverflow.com/a/6901395/556678.

Share:
8,926

Related videos on Youtube

Tiffany Walker
Author by

Tiffany Walker

Updated on September 18, 2022

Comments

  • Tiffany Walker
    Tiffany Walker over 1 year
    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
    

    Ideas as to why I'm getting this error?

    PHP 5.3.15 CloudLinux/CentOS 6 CPanel

    • Ladadadada
      Ladadadada almost 12 years
      Is your PHP the Apache module or CGI? And if it's CGI, do you have Apache installed? Do you have any other php.ini files anywhere on your system that could cause the difference? (A php.ini in your home directory will be picked up by CLI PHP.)
    • Tiffany Walker
      Tiffany Walker almost 12 years
      fcgid. they all use the same PHP ini file. yes, using Apache. No php.ini in the home dir.
    • apinstein
      apinstein over 11 years
      @TiffanyWalker did you ever resolve this? We've run into the exact same issue and can't figure it out. Even weirder, it happened on only one of two servers that were just freshly provisioned with chef so they have theoretically been configured the same way.
    • Tiffany Walker
      Tiffany Walker over 11 years
      I did resolve it... I just can't remember what I did. I think I killed off all the php processes and apache and then it worked when they came back up?
  • Tiffany Walker
    Tiffany Walker over 11 years
    sounds about right. i think i ended up cpying files over because i ran chroot