I have a Drupal 7 site with the CAPTCHA and ReCAPTCHA modules installed, but am having issues with caching (but not the normal issue!). The issue is that my user registration page should have a CAPTCHA displayed on it, but sometimes this CAPTCHA will stop displaying until I manually clear the cache through Admin -> Performance -> Clear All Caches.
I’m checking with an anonymous window in Chrome to ensure Drupal doesn’t recognize me and not show the CAPTCHA, even though I have the CAPTCHA’s persistence setting set to “Always add a challenge”
I’ve tried toying around with both the CAPTCHA and cache settings, but nothing seems to have any impact. All other information online seems to relate to how to re-enable the cache on CAPTCHA pages, where my issue is the opposite.
I’ve also successfully used CAPTCHA on other Drupal 7 builds with no issue and can’t figure out why this one is having the problem.
The site is http://respirometry.org. If you go to the user registration page, you may or may not see a CAPTCHA, depending on how long ago I manually cleared the cache.
I looked through Drupal’s logs and noticed I got an error about the file_temp_location right when the CAPTCHA stopped working. I went to Admin -> File System and changed the “Temporary Directory” to /tmp, which does not throw an error.
The error seems to be tied to the way ISPConfig has set up the site. It is accessible via either drupal.respirometry.org or respirometry.org, which have slightly different openbasedir settings, so my options seem to be either set the temp directory to /tmp, or to change the openbasedir settings on both sites so they can access each other’s temp directories.
The issue was caused by an invalid temp file location. The nature of the server and HTTP host aliasing caused some requests to not be able to write to the temp location. This caused a cascade that prevented the CAPTCHA from working. I modified the aliases to all redirect to the main URL, and changed the temp folder to /tmp just for good measure, and the CAPTCHA has remained intact for over 24 hours without issue.