4

When I try to save any form in the CiviCRM admin area, I get this error:

Sorry but we are not able to provide this at the moment.
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.

I have rebuilt my VM multiple times, and I'm fairly sure this has nothing to do with the cookie being set on the wrong domain.

What am I doing wrong? I hope this is me doing something stupid and not an actual bug, but I made a JIRA issue anyway: CRM-16508.

I have tracked the error message to this file, if that helps.

I am aware of this related question, but I am positive I'm not swapping between HTTP and HTTPS (I use HSTS) and I can't actually change any settings in the admin area anyway.

0

4 Answers 4

4

As Coleman's answer suggests, the most common cause for this I've seen is a mismatch between the URLs CiviCRM is configured to use and the ones it actually uses.

Other places to check are -

  • your webserver configuration (eg a canonical URL redirect)
  • the CIVICRM_UF_BASEURL constant in civicrm.settings.php
  • Administer > System Settings > Resource urls as Coleman mentions

If your site DB has been migrated to your VM, you may also need to follow the steps in Moving an existing CiviCRM installation.

If these various settings don't match, CiviCRM doesn't recognise / receive its session identifiers, and the result is this confusing (and often reported) error message.

1
  • 1
    I think we could learn from our various host CMS engines and move towards reducing some of these hardcoded configurations - they seem to cause a fair amount of confusion amongst site owners. Commented Jun 1, 2015 at 0:44
2

We experienced this issue today on our Wordpress installation of CiviCRM. The Apache/PHP Error log had the following output:

AH01071: Got error 'PHP message: PHP Warning:  session_start(): 
open(/var/lib/php/fpm/session/sess_f8fpr0iq1oclh7i6uun8bu3vd0, O_RDWR) 
failed: Permission denied (13) in /data/vhosts/ourwebsitedomain.org.uk/wp- 
content/plugins/civicrm/civicrm.php on line 305

PHP message: PHP Warning:  Unknown: 
open(/var/lib/php/fpm/session/sess_f8fpr0iq1oclh7i6uun8bu3vd0, O_RDWR) 
failed: Permission denied (13) in Unknown on line 0\nPHP message: PHP 
Warning:  Unknown: Failed to write session data (files). Please verify that 
the current setting of session.save_path is correct 
(/var/lib/php/fpm/session) in Unknown on line 0'

In our case, our server provider (Rackspace) found that a recent automated update of either our PHP or Apache packages caused a change of ownership for a couple of php-fpm related directories from 'apache' to 'root'. Once this change of ownership was rectified the problem disappeared.

These directories in our case were:

/var/lib/php/fpm

/var/lib/php/fpm/session

1

Please ensure you have correctly configured Administer > System Settings > Resource urls.

1

This error has a multitude of causes, and is often (not always) unrelated to session keys and cookies.

A cause of this problem I haven't seen mentioned on other Stack Exchange questions (1, 2, 3, 4) is that this occurs when your forms allow file uploads, and those file uploads exceed the upload_max_filesize/post_max_size defined in your php.ini file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.