Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[Solved][APC] Configuration file resets itself.

FalanyxFalanyx New
edited August 2014 in Vanilla 2.0 - 2.8

Hi, just dropped 2.1.1 onto my server and configured it as recommended in the installation instructions, but I'm having a slight issue. Any time I visit any forum page (discussions, dashboard, etc.), the conf/config.php file resets itself to a 'default' state. This occurs with both administrator and anonymous(guest) users. This occurs with both changes from the dashboard itself (such as themes. They are not applied because of this) or changes made directly to it. No errors are given on the forums themselves nor in the server error log.

Environment:

  • Linux 3.14.5 x86_64
  • Nginx/1.6.0 (compiled with Passenger 4.0.45)
  • PHP 5.4.4-14 (fpm-fcgi)

Steps to reproduce:

  • Install Vanilla Forums 2.1.1 (or git master)
  • chown -R nginx forum/
  • chmod -R 755 forum/
  • chmod -R 777 forum/conf forum/cache forum/uploads
  • Proceed through standard database/user setup

Vanilla configuration (in the state it is being reverted to):

<?php if (!defined('APPLICATION')) exit();

// Conversations
$Configuration['Conversations']['Version'] = '2.1.1';

// Database
$Configuration['Database']['Name'] = 'forums';
$Configuration['Database']['Host'] = 'localhost';
$Configuration['Database']['User'] = '';
$Configuration['Database']['Password'] = '';

// EnabledApplications
$Configuration['EnabledApplications']['Conversations'] = 'conversations';
$Configuration['EnabledApplications']['Vanilla'] = 'vanilla';

// EnabledPlugins
$Configuration['EnabledPlugins']['GettingStarted'] = 'GettingStarted';
$Configuration['EnabledPlugins']['HtmLawed'] = 'HtmLawed';

// Garden
$Configuration['Garden']['Title'] = 'Athrenae';
$Configuration['Garden']['Cookie']['Salt'] = 'LAGZI0YWDD';
$Configuration['Garden']['Cookie']['Domain'] = '';
$Configuration['Garden']['Registration']['ConfirmEmail'] = TRUE;
$Configuration['Garden']['Email']['SupportName'] = 'Athrenae';
$Configuration['Garden']['InputFormatter'] = 'Html';
$Configuration['Garden']['Version'] = '2.1.1';
$Configuration['Garden']['RewriteUrls'] = TRUE;
$Configuration['Garden']['Cdns']['Disable'] = FALSE;
$Configuration['Garden']['CanProcessImages'] = TRUE;
$Configuration['Garden']['SystemUserID'] = '2';
$Configuration['Garden']['Installed'] = TRUE;
$Configuration['Garden']['InstallationID'] = '';
$Configuration['Garden']['InstallationSecret'] = '';

// Plugins
$Configuration['Plugins']['GettingStarted']['Dashboard'] = '1';

// Routes
$Configuration['Routes']['DefaultController'] = 'discussions';

// Vanilla
$Configuration['Vanilla']['Version'] = '2.1.1';

// Last edited by Falanyx (104.35.96.23)2014-08-04 16:02:29

Nginx configuration:

server {
  listen 80;
  listen 443 ssl;
  server_name www.athrenae.com;
  access_log /var/www/athrenae.com/logs/access.log;
  error_log /var/www/athrenae.com/logs/error.log notice;
  ssl_certificate /var/www/athrenae.com/ssl/athrenae.crt;
  ssl_certificate_key /var/www/athrenae.com/ssl/athrenae.key;
  ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers HIGH:!aNull:!MD5;
  root /var/www/athrenae.com/www/;
  index index.php index.html index.htm index;

  location = /favicon.ico {
    log_not_found off;
    access_log off;
  }

  location = /robots.txt {
    log_not_found off;
    access_log off;
  }

  location /forum/ {
    try_files $uri $uri/ @forum;
  }

  location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index index.php;
  }

  location @forum {
    rewrite ^/forum/(.+)$ /forum/index.php?p=$1 last;
  }
}

Thank you ahead of time for any assistance with this. If any more information is needed, I would be more than happy to provide it.

~ Falanyx

Comments

  • Hi Falanyx, what version did you upgrade from, 2.1?

  • I've redacted your database name & password. Please be careful when posting config data to not include sensitive things. :) API private keys is another thing to watch out for.

  • @Linc This is a fresh installation, not an upgrade.

  • @Linc Oh, forgot those were in there. Thank you. We seem to have made edits at the same time to it, so went back and re-redacted it.

  • You did the installation on the server, and didn't move it there from somewhere else, right?

    Can you go to forum/conf and type ls -la to verify the permissions there?

  • Installation was on the server. wget, unzip, mv (or when I tried git master, git clone, mv)

    root@bahamut:/var/www/athrenae.com/www/forum/conf# ls -la
    total 36
    drwxrwxrwx  2 nginx root   4096 Aug  4 16:12 .
    drwxrwxr-x 11 nginx nginx  4096 Aug  4 15:37 ..
    -rwxrwxrwx  1 nginx root  14044 Aug  2 19:01 config-defaults.php
    -rwxrwxr-x  1 nginx nginx  1713 Aug  4 16:12 config.php
    -rwxrwxrwx  1 nginx root   2268 Aug  2 19:01 constants.php
    -rwxrwxrwx  1 nginx root    283 Aug  2 19:01 readme.txt
    

    Incidentally, noticed the write flag for other was not applied. Reapplied it a moment ago (chmod 777 config.php, verified with ls -la) and navigated to the index page of the forums, it dropped the write flag again.

  • Vanilla chmods to 775, which isn't my favorite thing in the world, but it's better than 777.

    Are you sure nginx is running as user 'niginx' in group 'nginx'?

  • Entirely.

    /opt/nginx/conf/nginx.conf:

    user  nginx nginx;
    ...
    

    ps aux:

    root@bahamut:/var/www/athrenae.com/www/forum/conf# ps aux | grep nginx
    nginx     5946  0.0  1.1 206232 24404 ?        S    07:03   0:02 php-fpm: pool www                                 
    nginx     5947  0.0  1.0 204148 21456 ?        S    07:03   0:01 php-fpm: pool www                                 
    nginx     6055  0.0  1.0 204668 21720 ?        S    07:16   0:01 php-fpm: pool www                                 
    root     10181  0.0  0.0  40328  1340 ?        Ss   16:36   0:00 nginx: master process /opt/nginx/sbin/nginx
    nginx    10182  0.0  0.1  40328  2096 ?        S    16:36   0:00 nginx: worker process
    root     10184  0.0  0.0   7840   864 pts/1    S+   16:36   0:00 grep nginx
    
  • I have no idea then. I assume what's happening is the config settings are never written to the file at all - Vanilla changes the config settings in your current page view without actually reloading the config again, so when it goes to re-check it next it finds the same config as before. So my guess is it's not really a "reset" problem so much as a "can't write" problem.

  • @Linc Considering when I add, via VIm, the following configuration options and it reverts them on page load, I'd say they're being written.

    $Configuration['Debug'] = TRUE;
    $Configuration['Garden']['Debug'] = TRUE;
    

    Still, that functionality you just described does give me an idea. I'll play around with the code a bit and see if I can find what's causing this, and if I find anything, will follow up. Thanks again for the help!

  • Do you have memcached installed? It's possible it's reading from cache, then writing that back to the config. If you want to edit by hand, you'd need to manually break cache after doing so.

  • Alright, I feel completely embarrassed now. This was a server configuration error. I don't have memcached, but I do have APC installed, and for some reason, apc.stat was set to 0 in my php.ini. Changing the value to 1 fixed everything. Thank you again for the help, @Linc, and I apologize for the wasted time and confusion in this instance.

  • LincLinc Admin
    edited August 2014

    Hey no worries, glad you found the cause. And that I wasn't it. :D

  • peregrineperegrine MVP
    edited August 2014

    perhaps, a solution sayer badge?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.