Skip to content

Login Failure: all versions below 4.1.4

Robert Spencer edited this page Jun 13, 2024 · 11 revisions

Login Failure: all versions below 4.1.4

Background

(Some technical information follows - skip to "What now??" if you're not interested in this stuff)

The ChurchCRM development team became aware of a problem affecting some users being unable to login (#5357, #5364, #5362). After investigation it became evident the problem was a combination of our code, and a a recent update to PHP, which has been applied to all currently supported PHP releases. Long story short, our login session uses a character that this new PHP patch rejected which meant all logins were succeeding, but the session establishment failed.

What now??

If your ChurchCRM is refusing to let you log in, there are two options

  1. Manually apply a code change to restore logins, then use the in-app upgrade wizard.
  2. Manual upgrade to ChurchCRM 4.1.4 (or later version)

Option #1 - Manually patch your existing code

You will need to change one line in the Bootstrapper.php file. Once this file is saved, logins should start working again.

  1. Find the ChurchCRM/Bootstrapper.php in your existing ChurchCRM deployment. For example, if your ChurchCRM is deployed on your web server at /var/www/churchcrm then the file will be in /var/www/churchcrm/ChurchCRM/Bootstrapper.php.

  2. Open the Bootstrapper.php in a text editor. At or around line 217 there will be the following block of code:

    public static function initSession()
    {
        // Initialize the session
        $sessionName = 'CRM@'.SystemURLs::getRootPath();
        session_cache_limiter('private_no_expire:');
        session_name($sessionName);
        session_start();
        self::$bootStrapLogger->debug("Session initialized: " . $sessionName);
    }
  3. Modify the line $sessionName = 'CRM@'.SystemURLs::getRootPath(); to read exactly as follows:

    $sessionName = 'CRM-'.hash("md5",SystemURLs::getDocumentRoot());
  4. The corrected code block should now look like this:

    public static function initSession()
    {
        // Initialize the session
        $sessionName = 'CRM-'.hash("md5",SystemURLs::getDocumentRoot()); // <--- ONLY this line was changed
        session_cache_limiter('private_no_expire:');
        session_name($sessionName);
        session_start();
        self::$bootStrapLogger->debug("Session initialized: " . $sessionName);
    }
  5. Save the file and log in.

  6. Once background tasks have been completed, you should see an automatic update task in the top right.

Option #2 - Manual Upgrade

Manual upgrades assume a certain level of comfort on the command line and/or FTP. If this is NOT you, consider option #1. Always make sure you have a backup of your existing setup before attempting an upgrade. A simple backup for a once-off upgrade like this might be (replace /var/www/churchcrm with your ChurchCRM installation path):

cp -a /var/www/churchcrm /var/www/churchcrm-old
mysqldump --user=youCCRMDBuser \
  --password=yourCCRMDBpassword \
  --add-drop-table \
  --routines \
  --triggers \
  --single-transaction ChurchCRMDB_NAME > /var/www/churchcrm-old/ChurchCRM.sql

Note: the database connection information will be in the /var/www/churchcrm/Include/Config.php file.

The steps involved in a manual upgrade are (replace /var/www/churchcrm with your directory where ChurchCRM is deployed):

  1. Download the Latest zip file (or at least 4.1.4+) from https://github.com/ChurchCRM/CRM/releases/latest into your "home" directory on your web host:

    cd $HOME
    wget https://github.com/ChurchCRM/CRM/releases/download/4.1.4/ChurchCRM-4.1.4.zip
    
  2. Unzip the release file:

    unzip ChurchCRM-4.1.4.zip

    This will create a churchcrm directory in your home directory.

  3. Update the files in the existing Church CRM directory using rsync if available, or cp if not:

    rsync -a $HOME/churchcrm/* /var/www/churchcrm/

    or

    cp -r $HOME/churchcrm/* /var/www/churchcrm/
  4. Update file permissions.

  5. Go back to the main page, click the upgrade database button.

  6. Log into your upgraded system.

Clone this wiki locally