1

Note: Search below for the '==========' pattern to jump to updates on this ticket.

I just downloaded and activated CiviCRM (Version 5.70.2) for WordPress, and I noticed a "System Status: Warning" on the CiviCRM Home Page.

  • I clicked on the "View Details and Manage Alerts" link to view the "CiviCRM System Status" page.
  • In the "Organization Setup" section of that page it asked me to "Please enter your organization's name, primary address and default FROM Email Address (for system-generated emails)."
  • I clicked on name and this took me to the "Organization Address and Contact Info" page.
  • I filled in the required fields on that page and clicked "Save" at the bottom.
  • This results in an error that ends with "Could not find a valid session key." (full message below)

This is very easy to reproduce.

I poked around a bit and found a log, specifically: ./wp-content /uploads /civicrm /ConfigAndLog /CiviCRM.1.f41ba7ebd6ad6ac9b22ac471.log

Here is the stack trace in that log file every time I reproduce this issue:

 trace: {
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:872 {
        CRM_Core_Controller->invalidKeyCommon()
        >   $msg = ts("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 administrator for assistance.") . '<br /><br />' . ts('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.') . '<br /><br />' . ts('Error type: Could not find a valid session key.');
        >   throw new CRM_Core_Exception($msg);
        > }
      }
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:867 { ...}
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:316 { ...}
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:193 { ...}
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller/Simple.php:49 { ...}
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php:61 { ...}
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:292 { ...}
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { ...}
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { ...}
      /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm.php:1231 { ...}
      /home4/uvfousor/public_html/wp-includes/class-wp-hook.php:324 { ...}
      /home4/uvfousor/public_html/wp-includes/class-wp-hook.php:348 { ...}
      /home4/uvfousor/public_html/wp-includes/plugin.php:517 { ...}
      /home4/uvfousor/public_html/wp-admin/admin.php:259 { ...}
    }
  }

Please let me know what I need to do to resolve this issue. Thanks!

==============
Friday - Mar08: While waiting for a response from @Aidan (or anyone else) I made an attempt to gain some insight on what might be the root cause.

I initially tried to enable debugging via "Administer menu > System Settings > Debugging and Error Handling" - but after clicking "Save" I get the same "Could not find a valid session key" error.

So, instead, I added some debug statements using the CRM_Core_Error::debug_log_message() method. I sprinkled these debug statements in civicrm/CRM/Core/Controller.php and civicrm/CRM/Core/Key.php.

Essentially, this is what I see...

  • When I click on "name", I see a call to the Key.php::sign() method with name=CRM_Contact_Form_Domain key=...CYQ==
  • I then see a composite key saved at Line Controller.php::319 that uses that "...CYQ==" key.
  • When I click SAVE, I see another call to sign() with name=CRM_Contact_Controller_Search, but with a different privateKey=...oKq==. This appears to overwrite the previous value.
  • In the same step, I see it retrieve the composite key and call the Key.php::validate() method.
  • However, I believe (this is a guess) that method is trying to validate against the most recent key (...oKq==) when it should use the "...CYQ==" key?

Hopefully, the above observations will trigger a memory for someone on this forum.

In the meantime, I am repeating my response to @Aidan (because the formatting is better in this area):

  1. Yes, cookies are enabled in my browser.
  2. Yes, I verified the 'CIVICRM_UF_BASEURL' at all steps above match the value in civicrm.settings.php.

==============
Sunday - Mar10: I don't believe this is a client issue as the same problem occurs on different PCs and different browsers. So, there must be something unique in my environment on the "https://uv4sor.org" wordpress server to explain why no one else sees this issue. CIVICRM experts - What can I collect to help identify the root cause?

==============
Monday - Mar11: I chatted with Bluehost support and they said "most of the plugins works in an older version of PHP", so as an experiment they downgraded PHP Version 8.2 to Version 7.4.

Interestingly, this got me past my original strange error and I was able to update the "Organization Address and Contact Info" page.

Bluehost also tried PHP Version 8.1 but this also shows the strange error, so they put it back to Version 7.4.

This experiment suggests there is some software on the host that CiviCRM requires, but that software fails with PHP8.2 and works with PHP7.4.

Perhaps that software needs to be updated on the host, but I have no clue on how to identify it.

Does anyone on this forum have a suggestion?

==============
Tuesday - Mar12: While on PHP7.4 I successfully enabled debugging to check if it reports anything interesting. I then switched to PHP8.1 and ran my test to generate the error with debug information. It seems to report the same information described in the original error, so not to helpful. I returned PHP back to 7.4.

Thanks to @Aidan for suggesting two other experiments to check if cookies are being sent but are not getting through - which is where a firewall or caching might affect things.

  • First, I set WP "Cache Level" to "Off" and tested again with PHP8.2. I then ran the test again and verified the error is still there. I returned PHP back to 7.4.
  • Second, I change WordFence "Web Application Firewall Status" from "Enabled and Protecting" to "Disabled" and tested again with PHP8.2. I then ran the test again and verified the error is still there. I returned PHP back to 7.4.

Unfortunately, no progress with identifying the root cause. Please let me know if anyone has another test I can run to help explain why Civi works with PHP7.4 but fails with PHP8.x.

==============
Thursday - Mar14: We thought we had something when we saw following error:

[13-Mar-2024 00:02:33 UTC] PHP Warning:  session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/ea-php81) in /home4/uvfousor/public_html/wp-content/plugins/civicrm/civicrm.php on line 494

We wondered if Civi needs access to the "/var/cpanel" directory. Currently, that directory is owned by 'root' and not readable by 'others', specifically:

[email protected] [~]# ls -ld /var/cpanel
drwx--x--x 125 root root 12288 Mar 12 19:44 /var/cpanel/

However, I checked with the cPanel forum and they report that directory "should be the 711 root:root like you are seeing."

I am curious to learn why civicrm.php is trying to access that directory. Perhaps that will lead to the root cause.

I am interested in digging deeper with instrumenting Civi code with debug statements. Can anyone suggest a good place to start to help identify the root cause?

==============
Wednesday - Mar20: Thanks to @Aidan for suggesting something is wrong with the "save_path" variable in the PHP8.1 environment, and suggesting I play with the session_save_path() function. I added a session_save_path('path/to/writable/directory') in CiviCRM's maybe_start_session() function, and my test is NOW passing.

The next step is to learn who (or what) is responsible for managing the "save_path" variable.

2 Answers 2

2

The "save_path" value is fine which specifies the directory for the PHP session cache. The problem is that directory does not exist on the Bluehost server.

I brought this to Bluehost's attention but they initially refused to fix the issue. They eventually did correct their server after several arduous chats with Bluehost.

While waiting for Bluehost to finally fix this issue, the workaround described in my "Mar20" update allowed us to proceed.

1

Welcome to SE. The message says:

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 administrator 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.

  1. Are cookies enabled in your browser?
  2. Are you using the same url to access the page as is configured in your civicrm.settings.php?
2
  • - Yes, cookies are enabled in my browser. - Yes, I verified the 'CIVICRM_UF_BASEURL' at all steps above match the value in civicrm.settings.php. - I also tried to enable debugging via "Administer menu > System Settings > Debugging and Error Handling" - but after clicking "Save" I get the same error. - Is there a different mechanism I can use to enable debugging?
    – Art
    Mar 7 at 21:56
  • Other thing to check - which you probably have done - is having a mix of settings for http and https
    – petednz - fuzion
    Mar 10 at 21:06

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.