0

I have a properly installed Symfony2 environment for my web application, which is connected to a certain mysql database.

I am trying to set a physically separated Testing Environment to use it as the pre-production testing environment as a "mirror" of production, locating a copy of the whole project in a subfolder of the "www".

Something like:

www
  |app
      |config
          |parameters.ini
  |src
  |vendor
  |web
  (...)
  |testing_environment
      |app
          |config
              |parameters.ini
      |src
      |vendor
      |web
      (...)

Take a look to the parameters.ini files. In the upper one (the one in the production environment), I have set the connection of the production database with its hostname, database name, user and password.

In the second parameters.ini (the one under testing_environment/app/config), I have set a different database connection pointing to what it will be the testing database.

My plan is to access to the production environment just putting www.myproject.com/web/main and to the testing environment going to www.myproject.com/testing_environment/web/main. One accesing each database separately.

Actually, I do get to access the testing environment, seen the testing version of my project, with its different set of directories, subdirectories and files. But, for some reason, the database properties that are being used both going to www.myproject.com/web/main and to www.myproject.com/testing_environment/web/main are the ones set in production parameters.ini file, causing that the only data accessed and modified is the production environment one, no matter what environment I am accessing in my browser.

Why this happens? Isn't it all relatively referenced? Wouldn't the testing environment have to be pointing to its own parameters.ini with its different database connection properties?

I have read Symfony2 documentation about setting different environments with different configurations, bundles and/or toolbars. But that doesn't allow to work with a different set of databases and directories/files.

What am I missing? How do I get what I need without hiring a diferent hosting for my pre-production testing works?

4

2 回答 2

0

我很抱歉这么说,但你做错了。阅读有关 Symfony2 环境和前端控制器的信息。不同的配置是通过在app/config. 并放入不同的前置控制器web

有什么要读的:

于 2013-06-04T21:20:11.463 回答
0

好,我知道了!

这是缓存目录的问题。

当我复制整个 Symfony 文件夹时,它进入了整个 app/logs 和 app/cache 文件夹。

删除这两个文件夹后,使用第一个 http 请求重新生成缓存并存储新的连接数据库。

所以问题是我不知道 Symfony2 在缓存中以某种方式连接到数据库。顺便说一句,可能与教义有关。

于 2013-06-06T20:55:29.640 回答