title: My website wont connect to my databse Codeigniter on Namecheap {getaddrinfo Failed}
body: <p>I've uploaded my Codeigniter project via filezilla. My databse has been installed on Cpanel I've added a user with password and changed my config/database.php file.</p>
  
  <p>which is here: </p>
  
  <pre><code>&lt;pre&gt;$active_group = 'default';
  $query_builder = TRUE;
  
  $db['default'] = array(
      'dsn'   =&gt; '',
      'hostname' =&gt; 'http://mywebsite.space',
      'username' =&gt; 'myuser',
      'password' =&gt; 'mypassword',
      'database' =&gt; 'theNameOfMyDatabase',
      'dbdriver' =&gt; 'mysqli',
      'dbprefix' =&gt; '',
      'pconnect' =&gt; FALSE,
      'db_debug' =&gt; FALSE,
      'cache_on' =&gt; FALSE,
      'cachedir' =&gt; '',
      'char_set' =&gt; 'utf8',
      'dbcollat' =&gt; 'utf8_general_ci',
      'swap_pre' =&gt; '',
      'encrypt' =&gt; FALSE,
      'compress' =&gt; FALSE,
      'stricton' =&gt; FALSE,
      'failover' =&gt; array()
  );
  
  echo '&lt;pre&gt;';
    print_r($db['default']);
    echo '&lt;/pre&gt;';
  
    echo 'Connecting to database: ' .$db['default']['database'];
    $dbh=mysql_connect
    (
      $db['default']['hostname'],
      $db['default']['username'],
      $db['default']['password'])
      or die('Cannot connect to the database because: ' . mysql_error());
      mysql_select_db ($db['default']['database']);
  
      echo '&lt;br /&gt;   Connected OK:'  ;
      die( 'file: ' .__FILE__ . ' Line: ' .__LINE__); 
  &lt;/pre&gt;`
  </code></pre>
  
  <p>The error I get when I navigate to my wesbite address:</p>
  
  <pre><code>&lt;pre&gt;
  Cannot connect to the database because: 
  php_network_getaddresses: 
  getaddrinfo failed: 
  Name or service not known
  &lt;/pre&gt;
  </code></pre>
  
  <p>I do have my codeigniter files in a folder off the root public_html folder.</p>
  
  <p>public_html/myproject/
  please help.</p>