Answers.Body: <p>Checked the server logs.</p>
  
  <p>.htaccess had file permissions set to 0664.</p>
  
  <p>Changed those permissions to 0644, and this problem went away.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-21T01:14:48.277Z
Answers.Text: Hey @Dragonfly, can you give more details of your solution? I'm getting the same error with contributions via PayPal Standard. (Everything else in CiviCRM is working fine.) Which `.htaccess` file needed to have its permissions changed? Which log file did you check, and what error was reported there? Thanks!
Answers.UserDisplayName: Martin_W
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-22T14:09:54.427Z
Answers.Text: @Martin_W:
  
  .htaccess file: It was the .htaccess file in the web root directory.
  
  Server logs: I believe I checked the error log(s) that you can bring up in cPanel. I can't be 100% sure, as this was a while ago now.
  
  I hope this helps. Let me know if you have any other questions.
Answers.UserDisplayName: Dragonfly
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-17T15:02:51.233Z
Answers.LastActivityDate: 2019-06-17T15:02:51.233Z
Answers.UserDisplayName: Dragonfly
Answers.Body: <p>Many of these "lost session" issues (which stem mainly from <code>redirect_canonical</code> correcting CiviCRM's malformed URLs) are solved in more recent versions of CiviCRM. All I can really do is suggest you upgrade. FWIW, you can pick through the PRs that deal with URLs here:</p>
  
  <p><a href="https://github.com/civicrm/civicrm-core/pulls?q=is%3Apr+author%3Achristianwach+is%3Aclosed" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pulls?q=is%3Apr+author%3Achristianwach+is%3Aclosed</a></p>
  
  <p>However, backporting them to your older version of CiviCRM might be more effort than upgrading.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-28T18:48:38.967Z
Answers.Text: Thanks for the suggestion.
  
  Upgraded to CiviCRM 5.13.3. Still get the same result.
Answers.UserDisplayName: Dragonfly
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-19T11:22:31.817Z
Answers.LastActivityDate: 2019-02-19T11:22:31.817Z
Answers.UserDisplayName: Christian Wach
Answers.Body: <p>I was getting similar errors on a Drupal site - turned out it was timing out during PDF creation for the email receipts, disabling PDF generation resolved the issue for now.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-28T18:49:29.983Z
Answers.Text: Thanks for the suggestion.
  
  I tested this and it did not solve the issue.
Answers.UserDisplayName: Dragonfly
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-19T22:23:11.267Z
Answers.LastActivityDate: 2019-02-19T22:23:11.267Z
Answers.UserDisplayName: freeform.steph
Answers.Body: <p>Hi @dragonfly I am having the same issue and can't seem to get this to resolve</p>
  <p>/home/emptyhometax/www/www/.htaccess</p>
  <p>this is what is in my .htaccess at the above path</p>
  <h1 id="begin-wordpress-r99c">BEGIN WordPress</h1>
  <h1 id="the-directives-lines-between-begin-wordpress-and-end-wordpress-are-3pgw">The directives (lines) between &quot;BEGIN WordPress&quot; and &quot;END WordPress&quot; are</h1>
  <h1 id="dynamically-generated-and-should-only-be-modified-via-wordpress-filters-8ps4">dynamically generated, and should only be modified via WordPress filters.</h1>
  <h1 id="any-changes-to-the-directives-between-these-markers-will-be-overwritten-eysf">Any changes to the directives between these markers will be overwritten.</h1>
  
  RewriteEngine On
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  
  <h1 id="end-wordpress-xvnf">END WordPress</h1>
  <p>everything was working fine and now the form wont work. no notable updates to site.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-23T15:48:08.863Z
Answers.LastActivityDate: 2021-07-23T15:48:08.863Z
Answers.UserDisplayName: emptyhometax
Body: <p>Error: "Error type: Could not find a valid session key."</p>
  
  <p>This is similar to a number of other times people have run into this problem, but I've looked through all of those here on StackExchange, have tried those things, and have not found any luck yet.</p>
  
  <p>When donating via a contribution page, receive an HTTP 500 error instead of the thank-you page and thank-you email receipt. The contribution record is logged into the database, but the website can't go to the right page because the session key is invalid. It is going to
  <a href="https://example.org/civicrm/?page=CiviCRM&amp;q=civicrm/contribute/transact" rel="nofollow noreferrer">https://example.org/civicrm/?page=CiviCRM&amp;q=civicrm/contribute/transact</a></p>
  
  <p>This used to work fine. Recently moved to new server, updated civicrm.settings.php and the Directories and Resource URLs pages appropriately.</p>
  
  <p>Any ideas? Am I missing something really obvious? </p>
  
  <p>I could always go up to Stripe 5.2 and CiviCRM 5.3, but was hoping to be able to fix it in this version.</p>
  
  <hr>
  
  <p>Cookies are enabled in the browser. Have reproduced in 2 browsers and on
  2 machines.</p>
  
  <p>Error details:</p>
  
  <p>Feb 05 16:07:33  [info] $Fatal Error Details = Array
  (
      [message] => 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.&lt;br /&gt;&lt;br /&gt;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 <a href="http://example.org" rel="nofollow noreferrer">http://example.org</a>, but some users are accessing the page via <a href="http://www.example.org" rel="nofollow noreferrer">http://www.example.org</a> or a domain alias like <a href="http://myotherexample.org.&lt;br" rel="nofollow noreferrer">http://myotherexample.org.&lt;br</a> /&gt;&lt;br /&gt;Error type: Could not find a valid session key.
      [code] =>
  )</p>
  
  <p>Feb 05 16:07:33  [info] $backTrace =
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(378): CRM_Core_Error::backtrace("backTrace", TRUE)</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(833): CRM_Core_Error::fatal("We can't load the requested web page. This page requires cookies to be enable...")</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(853): CRM_Core_Controller->invalidKeyCommon()</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Controller/Contribution.php(74): CRM_Core_Controller->invalidKeyRedirect()</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(312): CRM_Contribute_Controller_Contribution->invalidKey()</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(204): CRM_Core_Controller->key("CRM_Contribute_Controller_Contribution", TRUE, FALSE)</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Controller/Contribution.php(55): CRM_Core_Controller->__construct("CiviContribute", "null")</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(304): CRM_Contribute_Controller_Contribution->__construct("CiviContribute", TRUE, "null", NULL, "false")</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/civicrm.php(1216): CRM_Core_Invoke::invoke((Array:3))</p>
  
  <p>/home/example/public_html/wp-content/plugins/civicrm/includes/civicrm.basepage.php(141): CiviCRM_For_WordPress->invoke()
  internal function: CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))</p>
  
  <p>/home/example/public_html/wp-includes/plugin.php(579): call_user_func_array((Array:2), (Array:1))</p>
  
  <p>/home/example/public_html/wp-includes/class-wp.php(633): do_action_ref_array("wp", (Array:1))</p>
  
  <p>/home/example/public_html/wp-includes/functions.php(886): WP->main("")</p>
  
  <p>/home/example/public_html/wp-blog-header.php(14): wp()</p>
  
  <p>/home/example/public_html/index.php(17): require("/home/example/public_html/wp-blog-header.php")
  {main}</p>
  
  <hr>
  
  <p>Versions:</p>
  
  <pre><code>Wordpress 4.3.6
  CiviCRM 4.7.30
  Stripe payment processor extension  4.7.3
  PHP 5.6
  </code></pre>
  
  <hr>
  
  <p>CIVICRM_UF_BASEURL from civicrm.settings.php, Site address, and WP address are identical</p>
  
  <p>Path Variables:</p>
  
  <pre><code>[cms.root]      /home/example/public_html
  [civicrm.root]  /home/example/public_html/wp-content/plugins/civicrm/civicrm
  [civicrm.files] /home/example/public_html/wp-content/uploads/civicrm
  </code></pre>
  
  <p>Resource URLs: (these all look right)</p>
  
  <pre><code>CiviCRM Resource URL      [civicrm.root]/
  Image Upload URL          [civicrm.files]/persist/contribute/
  Extension Resource URL    /wp-content/plugins/files/civicrm/
  </code></pre>
  
  <p>Directories: (these all look right)</p>
  
  <pre><code>Temporary Files Directory    [civicrm.files]/upload/
  Image Directory              [civicrm.files]/persist/contribute/
  Custom Files Directory       [civicrm.files]/custom/
  Extensions Directory         /home/example/public_html/wp-content/plugins/files/civicrm/
  </code></pre>
  
  <p>HTTPS is forced. For example, <a href="http://www.example.org" rel="nofollow noreferrer">http://www.example.org</a> resolves to <a href="https://example.org" rel="nofollow noreferrer">https://example.org</a>.</p>
  
  <p>in .htaccess:</p>
  
  <pre><code># Redirect to HTTPS
   RewriteCond %{HTTPS} off
   RewriteCond %{HTTP:X-Forwarded-Proto} !https
   RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  
  &lt;files wp-config.php&gt;
  order allow,deny
  deny from all
  &lt;/files&gt;
  
  # BEGIN cPanel-generated php ini directives, do not edit
  # Manual editing of this file may result in unexpected behavior.
  # To make changes to this file, use the cPanel MultiPHP INI Editor (Home &gt;&gt; Software &gt;&gt; MultiPHP INI Editor)
  &lt;IfModule php5_module&gt;
     php_flag asp_tags Off
     php_flag display_errors Off
     php_value max_execution_time 30
     php_value max_input_time 60
     php_value max_input_vars 1000
     php_value memory_limit 256M
     php_value post_max_size 8M
     php_value session.gc_maxlifetime 1440
     php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
     php_value upload_max_filesize 2M
     php_flag zlib.output_compression Off
  &lt;/IfModule&gt;
  # END cPanel-generated php ini directives, do not edit
  </code></pre>
  
  <hr>
  
  <p>Thank you for any help or ideas you can provide!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-19T19:00:05.097Z
Comments.Text: since this is a 'migration' i would go over your civicrm.settings.php and Directories and Resources with a fresh eye. it is often a simple typo in there that disrupts things.
Comments.UserDisplayName: petednz - fuzion
Tags: <wordpress><civicontribute><stripe><migration>
Title: "Could not find a valid session key." when making a contribution
ThreadText: # "Could not find a valid session key." when making a contribution
  
  (Asked by: username_0 on 2019-02-13)
  
  Error: "Error type: Could not find a valid session key."
  This is similar to a number of other times people have run into this problem, but I've looked through all of those here on StackExchange, have tried those things, and have not found any luck yet.
  When donating via a contribution page, receive an HTTP 500 error instead of the thank-you page and thank-you email receipt. The contribution record is logged into the database, but the website can't go to the right page because the session key is invalid. It is going to
  https://example.org/civicrm/?page=CiviCRM&q=civicrm/contribute/transact
  This used to work fine. Recently moved to new server, updated civicrm.settings.php and the Directories and Resource URLs pages appropriately.
  Any ideas? Am I missing something really obvious? 
  I could always go up to Stripe 5.2 and CiviCRM 5.3, but was hoping to be able to fix it in this version.
  
  Cookies are enabled in the browser. Have reproduced in 2 browsers and on
  2 machines.
  Error details:
  Feb 05 16:07:33  [info] $Fatal Error Details = Array
  (
      [message] => 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. />Error type: Could not find a valid session key.
      [code] =>
  )
  Feb 05 16:07:33  [info] $backTrace =
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(378): CRM_Core_Error::backtrace("backTrace", TRUE)
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(833): CRM_Core_Error::fatal("We can't load the requested web page. This page requires cookies to be enable...")
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(853): CRM_Core_Controller->invalidKeyCommon()
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Controller/Contribution.php(74): CRM_Core_Controller->invalidKeyRedirect()
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(312): CRM_Contribute_Controller_Contribution->invalidKey()
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(204): CRM_Core_Controller->key("CRM_Contribute_Controller_Contribution", TRUE, FALSE)
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Controller/Contribution.php(55): CRM_Core_Controller->__construct("CiviContribute", "null")
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(304): CRM_Contribute_Controller_Contribution->__construct("CiviContribute", TRUE, "null", NULL, "false")
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
  /home/example/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  /home/example/public_html/wp-content/plugins/civicrm/civicrm.php(1216): CRM_Core_Invoke::invoke((Array:3))
  /home/example/public_html/wp-content/plugins/civicrm/includes/civicrm.basepage.php(141): CiviCRM_For_WordPress->invoke()
  internal function: CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
  /home/example/public_html/wp-includes/plugin.php(579): call_user_func_array((Array:2), (Array:1))
  /home/example/public_html/wp-includes/class-wp.php(633): do_action_ref_array("wp", (Array:1))
  /home/example/public_html/wp-includes/functions.php(886): WP->main("")
  /home/example/public_html/wp-blog-header.php(14): wp()
  /home/example/public_html/index.php(17): require("/home/example/public_html/wp-blog-header.php")
  {main}
  
  Versions:
  Wordpress 4.3.6
  CiviCRM 4.7.30
  Stripe payment processor extension  4.7.3
  PHP 5.6
  
  
  CIVICRM_UF_BASEURL from civicrm.settings.php, Site address, and WP address are identical
  Path Variables:
  [cms.root]      /home/example/public_html
  [civicrm.root]  /home/example/public_html/wp-content/plugins/civicrm/civicrm
  [civicrm.files] /home/example/public_html/wp-content/uploads/civicrm
  
  Resource URLs: (these all look right)
  CiviCRM Resource URL      [civicrm.root]/
  Image Upload URL          [civicrm.files]/persist/contribute/
  Extension Resource URL    /wp-content/plugins/files/civicrm/
  
  Directories: (these all look right)
  Temporary Files Directory    [civicrm.files]/upload/
  Image Directory              [civicrm.files]/persist/contribute/
  Custom Files Directory       [civicrm.files]/custom/
  Extensions Directory         /home/example/public_html/wp-content/plugins/files/civicrm/
  
  HTTPS is forced. For example, http://www.example.org resolves to https://example.org.
  in .htaccess:
  # Redirect to HTTPS
   RewriteCond %{HTTPS} off
   RewriteCond %{HTTP:X-Forwarded-Proto} !https
   RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
  
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  
  
  
  order allow,deny
  deny from all
  
  
  # BEGIN cPanel-generated php ini directives, do not edit
  # Manual editing of this file may result in unexpected behavior.
  # To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
  
     php_flag asp_tags Off
     php_flag display_errors Off
     php_value max_execution_time 30
     php_value max_input_time 60
     php_value max_input_vars 1000
     php_value memory_limit 256M
     php_value post_max_size 8M
     php_value session.gc_maxlifetime 1440
     php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
     php_value upload_max_filesize 2M
     php_flag zlib.output_compression Off
  
  # END cPanel-generated php ini directives, do not edit
  
  
  Thank you for any help or ideas you can provide!
  
  **Tags:** wordpress, civicontribute, stripe, migration
  
  > **Comments:**
  > **username_1**: since this is a 'migration' i would go over your civicrm.settings.php and Directories and Resources with a fresh eye. it is often a simple typo in there that disrupts things.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_0 on 2019-06-17. Score: 2 | Accepted answer
  
  Checked the server logs.
  
  .htaccess had file permissions set to 0664.
  
  Changed those permissions to 0644, and this problem went away.
  
  > **Comments:**
  > **username_2**: Hey @username_0, can you give more details of your solution? I'm getting the same error with contributions via PayPal Standard. (Everything else in CiviCRM is working fine.) Which `.htaccess` file needed to have its permissions changed? Which log file did you check, and what error was reported there? Thanks!  
  > **username_0**: @username_2:  .htaccess file: It was the .htaccess file in the web root directory.  Server logs: I believe I checked the error log(s) that you can bring up in cPanel. I can't be 100% sure, as this was a while ago now.  I hope this helps. Let me know if you have any other questions.  
  
  ---
  
  ### Answer by username_3 on 2019-02-19. Score: 3
  
  Many of these "lost session" issues (which stem mainly from `redirect_canonical` correcting CiviCRM's malformed URLs) are solved in more recent versions of CiviCRM. All I can really do is suggest you upgrade. FWIW, you can pick through the PRs that deal with URLs here:
  
  <https://github.com/civicrm/civicrm-core/pulls?q=is%3Apr+author%3Achristianwach+is%3Aclosed>
  
  However, backporting them to your older version of CiviCRM might be more effort than upgrading.
  
  > **Comments:**
  > **username_0**: Thanks for the suggestion.  Upgraded to CiviCRM 5.13.3. Still get the same result.  
  
  ---
  
  ### Answer by username_4 on 2019-02-19. Score: 2
  
  I was getting similar errors on a Drupal site - turned out it was timing out during PDF creation for the email receipts, disabling PDF generation resolved the issue for now.
  
  > **Comments:**
  > **username_0**: Thanks for the suggestion.  I tested this and it did not solve the issue.  
  
  ---
  
  ### Answer by username_5 on 2021-07-23. Score: 0
  
  Hi @dragonfly I am having the same issue and can't seem to get this to resolve
  
  /home/username_5/www/www/.htaccess
  
  this is what is in my .htaccess at the above path
  
  # BEGIN WordPress
  
  # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
  
  # dynamically generated, and should only be modified via WordPress filters.
  
  # Any changes to the directives between these markers will be overwritten.
  
  RewriteEngine On
  RewriteRule .\* - [E=HTTP\_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST\_FILENAME} !-f
  RewriteCond %{REQUEST\_FILENAME} !-d
  RewriteRule . /index.php [L]
  
  # END WordPress
  
  everything was working fine and now the form wont work. no notable updates to site.
  
  
  ---
  
  