I've a credit card applicatoin in Zend Framework that needs to run for any different time zone compared to server. Can there be a choice to create the database server (mysql within this situation) time zone in application.ini?

My current choices are:

assets.db.adapter = "Pdo_Mysql"

assets.db.params.charset = "utf8"

assets.db.params.driver_options.1002 = "SET NAMES utf8"

assets.db.params.host = "localhost"

assets.db.params.username = "usernam"

assets.db.params.password = "password"

assets.db.params.dbname = "databasename"

I understand I'm able to make a move like SET timezone = 'Europe/London', however i really should get it done within the config file.


Searching around I discovered that assets.db.params.driver_options.1002 ought to be setting the worthiness for PDO::MYSQL_ATTR_INIT_COMMAND.

Therefore assets.db.params.driver_options.1002 = "SET NAMES utf8, time_zone = 'Europe/London'" should have the desired effect. But no luck to date.


Thought it was. After lots of searching and debugging I discovered the next code at ZendDbAdapterPdoMysql.php

if (!empty($this->_config['charset'])) 

When I have assets.db.params.charset = "utf8" during my application.ini, it had been overwriting PDO::MYSQL_ATTR_INIT_COMMAND.

Removing that line solved it.

you may as well attempt to add it in your bootstrap:


class Bootstrap stretches Zend_Application_Bootstrap_Bootstrap 

I am responding to my very own question simply to close this, because the fact is already within the edits.




when i been on my application.ini can't be used together, as assets.db.params.charset ovewirites driver_options.1002.

If you want to set the timezone, remove assets.db.params.charset and pass the timezone within the charset in driver_options. E.g.:

assets.db.params.driver_options.1002 = "SET NAMES utf8, time_zone = 'Europe/London'"

Try build pre dispatch wordpress plugin and obtain data from config apply for query

This works best for me:

assets.db.adapter = "Pdo_Mysql"

assets.db.params.driver_options.1002 = "SET NAMES 'utf8', CHARACTER SET 'utf8', time_zone = 'Europe/London'"