troubleshooting configuration errors on site Symfony

SOLVED

Symfony 1.0.22

The site I'm working on has had a lot of people work on it. I feel like the configuration was maybe over-ridden in some places. I'm getting database connection errors with some front controllers, bt not others. How is that possible? For instance, I have this front controller:

The last line I'm thinking gets in the way of some of the normal config files from loading. I assume I can not move this without breaking the existing code, but can anyone suggest a way to force the loading of the normal config files?

I think it would be enough to manually force the loading of the yaml files in the top level config file?

<strong>UPDATE</strong>:

I realize now how much the original builders of the site broke out of the Symfony framework. They wrote their own DATABASE class, which handles most of the connections to the databases. I'm guessing they did this because the site has to switch back and forth between an old Microsoft database and a newer MySql database. They have a Config class that uses the DATABASE class to establish a connection to the database:

There is nothing wrong with any of this, except that somewhere they have seemingly de-activated the normal process whereby Symfony uses Propel to connect to the database. I'd like to know where I should look to force the Propel connection to happen.

I do not think any of this would over ride Symfony's normal process for connecting to the database.

UPDATE:

I notice there is no ProjectConfiguration.class.php in the top level config folder. ProjectConfiguration.class.php is standard on the projects I've worked on, using Symfony 1.1 and Symfony 1.2. Did it simply not exist back in version 1.0?

So, I am thinking the previous programmer turned off the database connections. But I need to find where that config setting is set.

UPDATE:

I have a partial solution now. If I open up the controller and paste in 2 lines to create a database connection, then everything works. This (with a lot of debugging junk) is what I have in my front controller right now:

Nothing shows up after "use database", so the 2 crucial lines that normally set up the database connection are never getting set. I am assuming the original programmer turned this off when they were writing all of their custom database connection code.

So, again, does anyone know where the sf_use_database configuration setting is set?

Answers (2)

=> (Please, give us al least the error string and backtrace if possible)

Check for "legacy" connection scripts scattered around your app, ex. using mysql_connect(). Maybe there is some component using this kind of code.
If not, check:
* your schema.yml file, pointing to the right connection('propel' by default)
* your model classes, same thing.

Try to add environment-specific configuration in your databases.yml (ex. a "dev" section with different connection parameters). Check the documentation or a newly generated databases.yml file for examples.

I never heard about such classes, sounds like custom ones.
I don't know why are they here. You have to dive in to understand how these works, and get rid of them wherever possible.
If you really need them, just be sure to load the configuration from databases.yml.

Sorry I had a wrong reading of your last update. I think it was the code from other front controller.

The code you have posted lately correspond to a normal apps/myapp/config/config.php one.
The last line seems to be added by hand. It just stands for a constant that may be used in some parts of the code. Check where and how it's being used.

As a side note, I strongly recommend to setup the xdebug php extension to perform some debugging in a dev machine (don't enable it on production server). It will help you a lot.

mppfiles, yes, sorry if I was unclear. The reference to "/topconfig/" is really weird. The folder is at the top level of the server. It is outside of the Symfony project. The file simply contains the database info:

That is the whole file. Most of the Symfony code fetches this and then, I think, manually creates a database connection. In other words, the people who built this system were barely using the Symfony framework.

include_once 'creole/Creole.php';
at Propel::getConnection()
in SF_ROOT_DIR/apps/cms/modules/zor/actions/actions.class.php line 25 ...
at zorActions->executeCourses()
in SF_SYMFONY_LIB_DIR/action/sfActions.class.php line 53 ...
at sfActions->execute()
in SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 129 ...
at sfExecutionFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 43 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR/filter/sfCommonFilter.class.php line 29 ...

Hold on...your latest version of your databases.yml has a "default" value on line 1. It must be just "propel". Just look [[LINK href="http://trac.symfony-project.org/browser/tags/RELEASE_1_0_22/data/skeleton/project/config/databases.yml"]]here [[/LINK]]to see the original file.
Hint: [[LINK href="http://trac.symfony-project.org/browser/tags/RELEASE_1_0_22/data/skeleton"]]this page[[/LINK]] contains the "default" files when creating new projects, apps, modules, etc.. Use it as a reference.

Thanks so much. You've been a huge help. Yes, in the app settings.yml file, the use_database had been uncommented and and set to "no". I did not copy and paste that part of the file, because I did not see that it had been uncommented.

sure, it is possible the configure:database task didnt exist for sf1.0
you have already fixed the databases.yml with the dsn
you can fix the propel.ini file manually or you can start a new project and then copy/paste the new propel.ini file, fixing the only the details