CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Could not find valid session key
Pages: [1] 2

Author Topic: Could not find valid session key  (Read 6847 times)

harveythiessen

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 3.36
  • CMS version: joomla 1.6
  • MySQL version: 2
  • PHP version: 5
Could not find valid session key
September 09, 2012, 11:08:58 am
Hi,

I have researched the above error and made sure that I have a redirect to www. in my .htaccess and all the civicrm php settings point to the same base url.  I do however get intermittent errors as below.  This happens when submitting a 'continue' button on a registration form or 'paypal' button.  Sometimes Chrome works, while IE and Mozilla don't and Safari will.  Then some time later, Chrome ill not work and the others do.  There is no apparent consistency to this.  I checked with my host who confirmed that my civicrm/joomla setting were correct.  I run 4.05 on Jommla 1.7.  I even tried migrating my  site to a different domain, upgrading that to lates joomla and civicrm (using akeeba) and still the same error persists there.


CiviCRM-001 -
Sorry. A non-recoverable error has occurred.
We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.

Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.

Error type: Could not find a valid session key.

Return to home page.

You may not be able to visit this page because of:

    an out-of-date bookmark/favourite
    a search engine that has an out-of-date listing for this site
    a mistyped address
    you have no access to this page
    The requested resource was not found.
    An error has occurred while processing your request.

Please try one of the following pages:

    Home Page

If difficulties persist, please contact the System Administrator of this site and report the error below..

Sorry. A non-recoverable error has occurred.
We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.

Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.

Error type: Could not find a valid session key.

Return to home page.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Could not find valid session key
September 10, 2012, 11:47:14 am
This happens for other users as well?

Did you try clearing caches and cookies in your browsers? Try deleting cache files in CiviCRM?

Does this site have any custom templates or PHP files?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Could not find valid session key
November 07, 2012, 06:34:28 pm
I have this with random users, occasionally, but have been unable to reproduce.

One user who has had this issue was using Chrome Version 22.0.1229.94 m

Ken

tmccartney

  • I post frequently
  • ***
  • Posts: 154
  • Karma: 9
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.28
Re: Could not find valid session key
January 22, 2013, 04:27:21 pm
I am having the same problem.  I am running Civi 4.2.6 on Drupal 7.  I notice there was an issue opened for it here and that a permanent fix is not planned until Version 4.3.

I know this project is open-source, but I will quarrel a bit with characterizing the bug as "minor," since it's keeping a considerable number of people from registering for events we have coming up.

Also, can someone walk me through applying the patch that appears on that issue page?  It looks like this:

Code: [Select]
--- a/docroot/sites/all/modules/civicrm/CRM/Core/Session.php
+++ b/docroot/sites/all/modules/civicrm/CRM/Core/Session.php
@@ -88,6 +88,9 @@ class CRM_Core_Session {
      */
     function __construct()
     {
+ if (!$_SESSION) {
+ session_start();
+ }
         $this->_session =& $_SESSION;
     }
 
--

Thanks!

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Could not find valid session key
January 23, 2013, 08:10:26 am
Quote from: tmccartney on January 22, 2013, 04:27:21 pm
Also, can someone walk me through applying the patch that appears on that issue page?  It looks like this:

Well, patches aren't meant to be applied manually, but I will tell you how if you don't tell anyone that I told you. :)

Find the file sites/all/modules/civicrm/CRM/Core/Session.php and around line 88 you should see:

Code: [Select]
function __construct()
     {
         $this->_session =& $_SESSION;
     }

There are 3 lines in the patch that have a plus sign on their left. You could remove the plus signs and then put those 3 lines into the file right there, so that the file now looks like:

Code: [Select]
function __construct()
     {
 if (!$_SESSION) {
 session_start();
 }
         $this->_session =& $_SESSION;
     }

I did not test this nor did I even see the original patch nor do I know what version it was written against nor do I accept liability if this fails etc. etc.

However, this is a pretty simple patch and you can do it by yourself as I wrote.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

tmccartney

  • I post frequently
  • ***
  • Posts: 154
  • Karma: 9
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.28
Re: Could not find valid session key
January 23, 2013, 08:23:37 am
Thanks, Hershel.  Have applied manually and am testing now.

So is the patch just meant to be made part of the next version?
« Last Edit: January 23, 2013, 08:35:15 am by tmccartney »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Could not find valid session key
January 23, 2013, 08:25:51 am
Patches are part of future versions, yes, or you can use a program such as diff to "apply" a patch automatically for you. For a tiny one like this you can do it by hand. For bigger ones, you can't.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

sstedman

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.17
  • MySQL version: 5.1
  • PHP version: 5.3.8
Re: Could not find valid session key
May 06, 2013, 02:46:15 pm
tmccartney, Have you had any luck with this issue since applying the patch? I am seeing the same error message on occasion with our users on Drupal 7 + CiviCRM 4.2.7.

Also, are you using the drupal module Secure Pages? Thanks.

tmccartney

  • I post frequently
  • ***
  • Posts: 154
  • Karma: 9
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.28
Re: Could not find valid session key
May 07, 2013, 08:10:30 am
Quote from: sstedman on May 06, 2013, 02:46:15 pm
tmccartney, Have you had any luck with this issue since applying the patch? I am seeing the same error message on occasion with our users on Drupal 7 + CiviCRM 4.2.7.

The patch seems to have helped.

Quote from: sstedman on May 06, 2013, 02:46:15 pm
Also, are you using the drupal module Secure Pages? Thanks.

Nope.

sstedman

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.17
  • MySQL version: 5.1
  • PHP version: 5.3.8
Re: Could not find valid session key
May 07, 2013, 10:13:54 am
Again, much appreciated tmccartney. I am applying the patch listed above and will report back whether or not the patch eliminated the sporadic "Could not find a session key errors" on D7 + Civi 4.2.7.

MichaelW

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7
  • MySQL version: --
  • PHP version: --
Re: Could not find valid session key
May 31, 2013, 07:15:37 am
I am encountering this problem is with Drupal 7 / CiviCRM 4.3.3.  When an anonymous user registers for some events, the session key cannot be found.

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Could not find valid session key
June 06, 2013, 03:54:50 am
Hershel,

I had a couple of issues with the patch. I'd get notices that $_SESSION wasn't defined, so I changed the code to
Code: [Select]
  function __construct() {
    if (empty($_SESSION)) {
        session_start();
    }
    $this->_session = &$_SESSION;
  }

I've now started getting notices saying that a session has already been started.
Quote
Notice: A session had already been started - ignoring session_start() in drupal_session_start() (line 287 of /var/www/citybibleforum/includes/session.inc).

I tried using drupal_session_start() rather than session_start(), but that introduces a CMS dependency into CiviCRM Core code (plus CLI code would throw a fatal error...
Quote
PHP Fatal error:  Call to undefined function drupal_session_start() in /var/www/citybibleforum/sites/all/modules/civicrm/CRM/Core/Session.php on line 86

Looking at the code for drupal_session_start() is occurs to me that there are CMS and environmental factors at play, and simply starting a session might cause other issues.

Ken

sonicthoughts

  • Ask me questions
  • ****
  • Posts: 498
  • Karma: 10
Re: Could not find valid session key
July 28, 2013, 06:21:47 pm
Note: having this same issue with 4.3.5 so I'm assuming that the patch has been committed. BTW, I have done a google search for this: "Error type: Could not find a valid session key" and it pops up a lot.  I'm happy to try to debug but not sure how.  The problem is that this is for anon users who register for events and not really sure if the registration succeeded or not.

sonicthoughts

  • Ask me questions
  • ****
  • Posts: 498
  • Karma: 10
Re: Could not find valid session key
September 01, 2013, 03:39:37 pm
Does anyone know if this is being addressed in 4.4?  I couldn't find anything definitive in Jira. 

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Could not find valid session key
September 01, 2013, 04:37:53 pm

 a variation of this patch is in the code base for 4.3 (and hence also for 4.4)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Could not find valid session key

This forum was archived on 2017-11-26.