As the name suggests, i'm having issues with my db class trying to autoload PDO.php
class DBObject extends PDO
{
public function __construct( $config )
{
$conn = "mysql:host=" . $config['host'] . ";dbname=" . $config[ 'dbname' ];
try
{
parent::__construct( $conn, $config['user'], $config['password'] );
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
echo $e->getMessage();
}
}}
This works fine locally.
autoload function:
function autoload( $className )
{
$filename = str_replace("_", DIRECTORY_SEPARATOR, $className ) . '.php';
require_once( $filename );
}
spl_autoload_extensions('.php');
// Use default autoload implementation
spl_autoload_register("autoload");
nothing fancy.
The strange this is the front end of the site works - no errors, everything displays fine, all database accesses work, but when I go into the backend on the staging server ( a custom cms made by the company i work for, which uses mysql_* ) it tries to load PDO.php in the autoloader when I load my models.
The only thing that I can think is causing the problem, is that the classes that use the DBObject are instantiated inside a function, but even then, thats just a guess, and a long shot. There's nothing fancy happening, no magic methods, no namespaces, no other autoload function
as i'm stuck on php 5.2.7 there is no namespaces, so none of the other threads i found on here help.
according to phpinfo, PDO is installed, with PDO Driver for MySQL, client library version 5.0.96
any help would be greatly appreciated.