Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4039058
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:33:18+00:00 2026-05-20T12:33:18+00:00

I have an application in Zend Framework that has to run for a different

  • 0

I have an application in Zend Framework that has to run for a different time zone than the server. Is there an option to set the database server (MySQL in this case) time zone in application.ini?

My current options are:

resources.db.adapter = "Pdo_Mysql"
resources.db.params.charset = "utf8"
resources.db.params.driver_options.1002 = "SET NAMES utf8"
resources.db.params.host = "localhost"
resources.db.params.username = "usernam"
resources.db.params.password = "password"
resources.db.params.dbname = "databasename"

I know I can do something like SET timezone = 'Europe/London', but I really need to do it in the config file.

EDIT

Googling around I found that resources.db.params.driver_options.1002 should be setting the value for PDO::MYSQL_ATTR_INIT_COMMAND.

Therefore resources.db.params.driver_options.1002 = "SET NAMES utf8, time_zone = 'Europe/London'" should do the trick. But no luck so far.

FINAL EDIT

Found it.
After a lot of searching and debugging I found the following code at Zend\Db\Adapter\Pdo\Mysql.php

if (!empty($this->_config['charset'])) {
    $initCommand = "SET NAMES '" . $this->_config['charset'] . "'";
    $this->_config['driver_options'][1002] = $initCommand; // 1002 = PDO::MYSQL_ATTR_INIT_COMMAND
}

As I have resources.db.params.charset = "utf8" in my application.ini, it was overwriting PDO::MYSQL_ATTR_INIT_COMMAND.

Deleting that line solved it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:33:19+00:00Added an answer on May 20, 2026 at 12:33 pm

    I’m answering my own question just to close this, as the response is already in one of the edits.

    resources.db.params.charset
    

    and

    resources.db.params.driver_options.1002
    

    as I had in my application.ini cannot be used together, as resources.db.params.charset ovewirites driver_options.1002.

    If you need to set the timezone, remove resources.db.params.charset and pass the timezone in the charset in driver_options.
    E.g.:

    resources.db.params.driver_options.1002 = "SET NAMES utf8, time_zone = 'Europe/London'"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Zend Framework (PHP) web application that has a table with a
I have a Zend Framework application structure as below: /application /library /Zend /Core /Filter
I have a social networking website built upon the zend framework. My application also
I have an application that sends messages to an external web service. I build
We have an application with a good amount of jQuery JSON calls to server
I have an application that displays an image inside of a Windows Forms PictureBox
I have an application that reads a CSV file with piles of data rows.
I have an application deployed into multiple zones and there are some issues with
I have an application that uses NHibernate as its ORM and sometimes it experiences
I get this error when trying to load a Zend Framework application: Fatal error:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.