ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Exposed and corrupted config file

January 21, 2011 7:24am

Subscribe [7]
  • #1 / Jan 21, 2011 7:24am

    onemanarmy

    23 posts

    Hi,

    I just encountered a very serious problem. All of a sudden, the config file got screwed up, so badly that the site not only stopped working, but also exposed the contents of the config file on every page of the site.

    I didn’t do anything anything myself on the server, this was caused by activity in the control panel.

    At first, I suspected that the Structure module could be the problem. But after checking their support pages, the author of Structure says that no writing is done to the config file.

    I really need to figure this problem out as I guess it could happen again. So to start with - Can I set the config file to be non-writeable? Or what parts of the system writes to the config file after the initial installation is done?

    I would really appreciate any feedback and input on this one.

    I’m using the latest version of EE.

    Thank you.

  • #2 / Jan 21, 2011 7:51am

    onemanarmy

    23 posts

    Looks like others experienced similar problems:
    http://ellislab.com/forums/viewthread/177647/

    So it seems it has to do with the site_pages array in the config file.
    What is the site_pages array used for?

    The people from Structure claim they don’t do any modifications to the config file, but isn’t this line found in mod.structure.php doing just that?

    $this->EE->config->update_site_prefs(array('site_pages' => $site_pages));
  • #3 / Jan 21, 2011 5:09pm

    Sue Crocker

    26054 posts

    Hi, onemanarmy.

    I’m not familiar with the Structure module, but that looks like writing to the site prefs to me.

    Are you using both the Structure module and the Pages module?

  • #4 / Jan 21, 2011 5:28pm

    onemanarmy

    23 posts

    Hi Sue, thanks for your reply.

    No, I only use Structure, Pages isn’t installed.

    What is the purpose of the site prefs array? I’m thinking of temporarily removing that line from Structure, but I’d like to know what site prefs is used for before I do that.

  • #5 / Jan 22, 2011 6:39pm

    Greg Salt

    3988 posts

    Hi onemanarmy,

    This is a Structure issue. Removing that line and the ‘site_pages’ config items should remove the errors. We’ve given the Structure developers a heads up about this.

    Cheers

    Greg

  • #6 / Jan 22, 2011 8:03pm

    airways

    154 posts

    onemanarmy,
    $this->EE->config->update_site_prefs makes database changes to exp_sites. It does apparently rewrite the config.php file, however you can stop this by setting it’s UNIX permissions in a way that prevents this from happening (host dependent, usually if the web host runs as a different user you can prevent write by group and/or world and this will stop the web server from rewriting the file) - this obviously may have other impacts on your site if you regularly use the CP to make config changes (which I don’t recommend).

    To answer your question about site_pages, this array is used to do lookups based on the URL when a request comes in that doesn’t match the template_group/template_name pattern. This is core functionality originally supporting the Pages module, and which is also used by Structure (which is the reason you can’t have them both installed). If you remove this line of code, any new pages created in Structure will not be accessible since the core EE system won’t know they exist. This would, obviously, be bad.

    I’d like to point out that this error would likely occur even if you were using the built-in Pages module. It also saves changes to this array, and presumably also causes a rewrite to the config.php file. The real problem here is that _update_config() doesn’t ignore values that it can’t convert into strings properly (such as ‘Array’).

  • #7 / Jan 24, 2011 2:29am

    John Henry Donovan

    12339 posts

    airways,

    Thanks for the detailed explanation. I’ll keep this thread open a while longer in case of any added feedback.

  • #8 / Jan 24, 2011 12:38pm

    rockthenroll

    485 posts

    We recently became aware of the source of this and worked with EllisLab to resolve the config.php issue. It’s a highly recommended upgrade: http://buildwithstructure.com/download

    We apologize for the trouble you’ve run into and if you have questions or want to speak further about it, please get in touch: contact[at]buildwithstructure[dot]com

    Thanks!

  • #9 / Jan 24, 2011 5:24pm

    Ingmar

    29245 posts

    Thanks for letting us know. Does that work for you?

  • #10 / Jan 24, 2011 5:26pm

    rockthenroll

    485 posts

  • #11 / Jan 25, 2011 10:35am

    Sue Crocker

    26054 posts

    onemanyarmy, does Travis’ information help?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases