title: Zend database connection failure
body: <p>Ok I am having real difficulty solving this. I'm trying to connect to a mysql database from a zend application and i receive the following error:</p>
  
  <pre><code>Message: No database adapter present
  </code></pre>
  
  <p>I have checked and double checked the connection credentials and they should be fine. The code should be fine too as it works ok in the development environment. If I deliberately change the password to be incorrect in the development environment, I get exactly the same error, which leads me to believe that maybe this is the case, despite my checking! </p>
  
  <p>Any thoughts would be very welcome. If there's nothing obviously wrong here then maybe I need to look at the server/db/php settings?</p>
  
  <p>Thanks!</p>
  
  <p>Bootstrap code:</p>
  
  <pre><code>class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
  {
  protected function _initPlaceholders(){
      Zend_Session::start();
  
      $this-&gt;bootstrap('View');
      $view = $this-&gt;getResource('View');
  
      $view-&gt;doctype('XHTML1_STRICT');
  
      // Set the initial stylesheet:
      $view-&gt;headLink()-&gt;appendStylesheet('/css/global.css');
  
      $autoloader = Zend_Loader_Autoloader::getInstance();
      $autoloader-&gt;registerNamespace('Pog_');
  
  
      Zend_Controller_Action_HelperBroker::addPath(
      APPLICATION_PATH . '/controllers/helpers',
          'Application_Controller_Action_Helper_');
  
  }
  
  
  }
  </code></pre>
  
  <p>Config file:</p>
  
  <pre><code>[production]
  phpSettings.display_startup_errors = 0
  phpSettings.display_errors = 0
  includePaths.library = APPLICATION_PATH "/../library"
  bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
  bootstrap.class = "Bootstrap"
  appnamespace = "Application"
  resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
  resources.frontController.params.displayExceptions = 0
  resources.view[] =
  resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
  resources.view.helperPath.View_Helper = APPLICATION_PATH "/views/helpers"
  database.adapter         = pdo_mysql
  database.params.host     = localhost
  database.params.username = user
  database.params.password = password
  database.params.dbname   = test
  </code></pre>
  
  <p>DB connection helper:</p>
  
  <p>
  
  <pre><code>/**
   * Constructor: initialize plugin loader
   *
   * @return void
   */
  public function __construct()
  {
      try{
  
          $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
          $dbAdapter = Zend_Db::factory($config-&gt;database);
          $dbAdapter-&gt;getConnection();
          $this-&gt;connection = $dbAdapter;
      } catch (Zend_Db_Adapter_Exception $e) {
          echo 'perhaps a failed login credential, or perhaps the RDBMS is not running';
      } catch (Zend_Exception $e) {
          echo 'perhaps factory() failed to load the specified Adapter class';
      }
  }
  public function getDbConnection(){
      return $this-&gt;connection;
  }
  }
  </code></pre>
  
  <p>Index:</p>
  
  <pre><code>// Define path to application directory
  defined('APPLICATION_PATH')
  || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
  
  // Define application environment
  defined('APPLICATION_ENV')
  || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
  
  // Ensure library/ is on include_path
  set_include_path(implode(PATH_SEPARATOR, array(
  realpath(APPLICATION_PATH . '/../library'),
  get_include_path(),
  )));
  
  /** Zend_Application */
  require_once 'Zend/Application.php';
  
  // Create application, bootstrap, and run
  $application = new Zend_Application(
  APPLICATION_ENV,
  APPLICATION_PATH . '/configs/application.ini'
  );
  $application-&gt;bootstrap()
          -&gt;run();
  </code></pre>