title: Fatal error: PDOException SQLSTATE[28000] [1045] Access denied
body: <p>I'm trying to install a PHP application that was coded by another guy that I can't contact and he used PDO.</p>
  
  <p>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:</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>I don't understand why is trying to look the user <em>www-data</em>. I looked in Google and found a lot of problems with this error, but from a CMS like <a href="https://en.wikipedia.org/wiki/Magento" rel="nofollow noreferrer">Magento</a> and nothing that can help me.</p>
  
  <ul>
  <li>PHP version: PHP 5.3.3-7</li>
  <li>PDO Driver for MySQL 5.1.49</li>
  <li>Apache version: Apache/2.2.16 (Debian)</li>
  <li>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</li>
  </ul>
  
  <p><strong>Update:</strong></p>
  
  <p>This are the two files used to connect to PDO:</p>
  
  <ul>
  <li>SPDO.php: <a href="http://pastebin.com/utCjresv" rel="nofollow noreferrer">http://pastebin.com/utCjresv</a></li>
  <li>class_Config.php: <a href="http://pastebin.com/6CENLDf3" rel="nofollow noreferrer">http://pastebin.com/6CENLDf3</a></li>
  </ul>
  
  <p>Start of SPDO.php:</p>
  
  <pre><code>&lt;?php
  class SPDO extends PDO
  {
          private static $instance = null;
          private static $dbhost="localhost";
  </code></pre>