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 6204817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:09:48+00:00 2026-05-24T05:09:48+00:00

I have a PHP application that is written with Zend Framework. It uses Phing

  • 0

I have a PHP application that is written with Zend Framework. It uses Phing for a build system and PHPUnit for unit testing. All these parts have configuration settings. Zend uses application.xml, Phing uses build.xml and optionally some build.properties, and PHPUnit uses phpunit.xml.

But where do I store information that is required by all three components? Think of database configuration (passwords for example).

In my case, the application.xml has various sections (dev, staging, production) all with a different database configurations. I have recently integrated an ORM in my application and now I want to unittest my models. So I have a fourth database (unittesting) which is used by PHPUnit.

PHPUnit can handle fixture data but not database schemas. So, I was thinking I’d write a Phing build target that copies the database schema from production or staging to the unittest database. This way I have the added benefit that I can even unittest my database migration scripts. But in order to do that, Phing needs access to several databases at the same time.

My first gut instinct was to put all the configuration for all four databases in build.properties and have Phing simply generate application.xml and phpunit.xml. But, it feels eh, dirty to have a build system generate configuration files.

What’s the best solution here? Or should I simply duplicatie the configuration details and not worry too much?

Thoughts

I could simply duplicate them. It’s only a few settings and they shouldn’t change often. But I bet that when they do change, I will have forgotten about the duplication (because it happens infrequently). Shared parameters include:

  • Database configuration (dev, staging, production and unittests)
  • Include paths. We use some older libraries that don’t work with autoloaders. So far we have partially solved this with an intelligent auto-prepend file.
  • A few webservice API credentials
  • 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-24T05:09:49+00:00Added an answer on May 24, 2026 at 5:09 am

    My first gut instinct was to put all the configuration for all four databases in build.properties and have Phing simply generate application.xml and phpunit.xml. But, it feels eh, dirty to have a build system generate configuration files.

    Well, to fully generate them seems a bit dirty. But if the build system simply does token replacement from Phing’s build.properties file on .dist versions of your various config files, that seems ok to me.

    For an example, see the source code of Dasprids blog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small AJAX application, written in PHP that I did not secure
I am using Zend Framework and 3rd party application written in php for file
We have a web application written in PHP that exports MySQL query results to
I have written a PHP application that broadcasts a voice message to phone numbers
I have a PHP application that displays a list of options to a user.
I have a PHP application that will on occasion have to handle URLs where
I have a PHP application that makes extensive use of Javascript on the client
I have a PHP web application on an intranet that can extract the IP
I have a PHP web application which uses a MySQL database for object tagging,
I have current PHP codebase written in procedural (mainly) style that our client is

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.