tags:

views:

157

answers:

2

Hello,

Can anyone help me with this?

I have this function in a singleton class. The error it is giving me back is that it cannot find the class.

First I thought it had something to do with the autoloader, but I did spl_autoload_unregister('libloader') and it still gives the same error?

The host is running php 5.

public static function getInstantie()
    {
     if (!self::$instantie)
     {
      $config = config::getInstantie();
      $db_type = $config->config_waarden['database']['db_type'];
      $hostnaam = $config->config_waarden['database']['db_hostnaam'];
      $dbnaam = $config->config_waarden['database']['db_naam'];
      $db_wachtwoord = $config->config_waarden['database']['db_wachtwoord'];
      $db_gebruikersnaam = $config->config_waarden['database']['db_gebruikersnaam'];
      $db_poort = $config->config_waarden['database']['db_poort'];

     self::$instantie = new PDO("$db_type:host=$hostnaam;port=$db_poort;dbname=$dbnaam",$db_gebruikersnaam, $db_wachtwoord);
      self::$instantie-> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     return self::$instantie;
    }

thanks, Richard

+1  A: 

is that function inside of a class that extends PDO? If not, can you try to make that function inside of a class that extends PDO and instead of self call the functions using keyword parent?

Anthony Forloney
A: 

PDO is enabled by default with a set of database drivers:

http://au.php.net/manual/en/pdo.installation.php

But the build of PHP you are working with could have it disabled. Autoloading will have no effect on whether or not the PDO class will be found.

Create a PHP info file and check to see if the PDO section exists. If it doesn't, then your issue is most likely because it wasn't built into your php installation.

Tres
thanks, it was in the back off my mind to check that out, but I thought it could not be the case. because it's part off the standard installation. Turns out digitalibiz does not have it installed. Do you possibly know what considerations they have for not installing it?
Richard
They have absolutely no reason not to. You might want to ask about their reasoning, however. If they do not have a good reason, I wouldn't trust them with my PHP installation ;).
Tres
I already submitted a ticket and told them I want to move my domain to my other host with an apache server. I was already frustrated that they diddn't had isapirewrite installed. At least, then I won't be running into those specific problems.
Richard
Which MVC framework are you using btw?
Tres