I am working on a project based on Zend 1.12. There is a new requirement in which we have to encode all of our files to prevent hacking. We used ioncube encoder which encode all of the .php file but not application.ini where it store db information username, password, secret key etc. There are two approach :
1) Have configuration reside in .php file such as config.php instead of application.ini
2) have ioncube encode application.ini
With the first approach I found Zend Config Introduction where you could have configuration store in array. I need a concrete example with setup in Bootstrap.php where it could utilize these configuration. Right now all of our model extends from Zend_Db_Table_Abstract. I really want when i migrate all the application.ini db configuration into config.php all the db operation works and there are several instance in front controller make use of $this->applicationOptions. I hope my putting configuration this will work as well. Please help
With second approach I did not found much resolution on ioncube be able to encode application.ini
This is my configuration file
return $configArray = array(
'db' => array( 'adapter' => 'pdo_mysql', 'params' => array( 'host' => 'localhost', 'username' => 'root', 'password' => 'root', 'dbname' => 'test' ) ) );
When i do this in Bootstrap.php and it work
$config = new Zend_Config(require APPLICATION_PATH .'/configs/config.php'); $db = Zend_Db::factory($config->db->adapter, $config->dv->params->toArray()); $db = Zend_Db::factory($config->db); Zend_Db_Table::setDefaultAdapter($db);
but when i do
protected function _initDatabase(){ $config = new Zend_Config(require APPLICATION_PATH .'/configs/config.php'); $resource = $this->getPluginResource('db'); var_dump($this->getPluginResource('db')); // this will be null.
My question is is should i do anything different in configuration so it will mimic resources.db.adapter, resources.db.params.host etc and it will be picking up by the pluginResources or getoptions