I'm trying to install a PHP application that was coded by another guy that I can't contact and he used PDO.

I'm getting a lot of problems to run this code. In some areas, MySQL connects well because PDO is not used (this shows that the username and password are right), but in others it throws this exception:

> 
> Fatal error: Uncaught exception
>  'PDOException' with message
>  'SQLSTATE[28000] [1045] Access denied
>  for user 'www-data'@'localhost' (using
>  password: NO)' in
>  /var/www/x/include/SPDO.php:14
>  Stack trace: #0
>  /var/www/x/include/SPDO.php(14):
>  PDO->\_\_construct('mysql:host=;dbn...',
>  NULL, NULL) #1
>  /var/www/x/include/SPDO.php(22):
>  SPDO->\_\_construct() #2
>  /var/www/x/include/class\_Projecte.php(55):
>  SPDO::singleton() #3
>  /var/www/x/dades\_proj\_edit.php(116):
>  Project->\_\_construct() #4 {main}
>  thrown in
>  /var/www/x/include/SPDO.php on line
>  14
> 
> 
> 

I don't understand why is trying to look the user *www-data*. I looked in Google and found a lot of problems with this error, but from a CMS like [Magento](https://en.wikipedia.org/wiki/Magento) and nothing that can help me.

* PHP version: PHP 5.3.3-7
* PDO Driver for MySQL 5.1.49
* Apache version: Apache/2.2.16 (Debian)
* Apache modules: core mod\_log\_config mod\_logio prefork http\_core mod\_so mod\_alias mod\_auth\_basic mod\_authn\_file mod\_authz\_default mod\_authz\_groupfile mod\_authz\_host mod\_authz\_user mod\_autoindex mod\_cgi mod\_deflate mod\_dir mod\_env mod\_mime mod\_negotiation mod\_php5 mod\_reqtimeout mod\_setenvif mod\_status

**Update:**

This are the two files used to connect to PDO:

* SPDO.php: <http://pastebin.com/utCjresv>
* class\_Config.php: <http://pastebin.com/6CENLDf3>

Start of SPDO.php:

```
<?php
class SPDO extends PDO
{
        private static $instance = null;
        private static $dbhost="localhost";

```