The original issue was:

Error: "You are using a feature that requires $cookie_domain to be set, but it is not set in your settings.php (CKFinder is enabled in the Advanced profile"

Any help would be highly appreciated.

What's the ticket is actually about: comment #18 by anarcat

From what I understand by reading this issue, it's because CKFinder bypasses the normal Drupal bootstrapping.

I do believe, however, that relying on a variable that *may* be defined in settings.php is a bug in that context. If you expect Drupal variables, you expect Drupal to be bootstrapped. If you bootstrap Drupal the wrong way, you're headed for a bunch of trouble, period.

The way the fix was proposed in Aegir was to add this line to the settings.php template:

$cookie_domain = $_SERVER['HTTP_HOST'];

I object to this change (edit: this change in aegir) on the ground that this work is already done by conf_init() (as found by Steven) in Drupal core itself.

If CKFinder doesn't bootstrap Drupal properly, it should at *least* default $cookie_domain properly, in the exact same way as above. It shouldn't be put on the users' shoulders to do that work instead of the module fixing its bootstrap code.

It could even be possible to load includes/common.inc and fire up conf_init()...

(I took the liberty of changing the issue title and type, I hope that's okay.)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mephir’s picture

Look to sites/all/default/settings.php, line about 169:

# $cookie_domain = 'somedomain';

uncomment this line and write there yourdomain with Drupal.

mephir’s picture

Status: Active » Fixed

If you have any lack of clarity about issue, feel free to reopen it.

Barb’s picture

I received the same message, and I don't know what to do given Response #2. I'm not sure how to get to "sites/all/default/settings.php, line about 169." I'm also not sure what "uncomment this line" means.

sp_key’s picture

Hi mephir,

I haven't dealt with the issue yet.
One thing, could you please help me understand what it actually means and why it occurred now?
Anything wrong with my installation?

mephir’s picture

@Barb:
"uncomment" - remove # from start of the line,
$cookie_domain should have value with your domain where is Drupal installed f.e.:
You have drupal installation on domain yourdomain.com, so $cookie_domain should look like below:

$cookie_domain = 'yourdomain.com';

If have installation on localhost, you should have something like that:

$cookie_domain = 'localhost';
wwalc’s picture

why it occurred now?

it is required by CKFinder, perhaps you have enabled it.
Because CKFinder is launched "outside" Drupal engine, this setting is required to be able to bootstrap Drupal and access Drupal environment and sessions to check user permissions.

sp_key’s picture

Cool, many thanks.
The error has been fixed for me

whiteley’s picture

I wonder if you could clarify this at all. We often use domain access for sites that have unrelated domain names and don't set the cookie_domain explicitly and it gets set in bootstrap.inc based on the site_name. I don't understand the explicit check for variable assignment in settings.php vs. variable existence.

Thanks!

focusmetacoaching’s picture

I get this message after I tried to change settings.php: The message comes when I try to go to the web-page

Fatal error: Call to undefined function check_markup() in /home/web78036/domains/focusmetacoaching.se/public_html/modules/node/node.module on line 1044

I don´t understand why the error message comes from a different place of the code.
tried to change things in settings.php, but nothing seems to change... what can I do?

txs

LarryZ’s picture

I copied $cookie_domain = 'localhost'; to the following line with the $ in column 1.
I left my FCKeditor settings as is, File browser type: IMCE, and allow quick uploads.
After this change I receive, "Acess Denied".
I am using WAMP with Win XP Pro.

This is a recent problem. I think it started after I updated some modules. It was working before.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ClearXS’s picture

Status: Closed (fixed) » Active

Very nice; I tried both solutions.

The result was that I got logged out of my admin account for the page I was on. Trying to get a new password to my email resulted in errors (maybe due to many email subscription aso modules I installed yesterday).

I´m not sure if this solution is possible with booster and some other settings?

(I disabled the rule in settings.php and had another screen in my memory and could use it again for new admin screens)

ClearXS’s picture

Version: 6.x-1.0 » 6.x-1.x-dev

setting the version to the latest dev 1 series, as I´m using that one

wwalc’s picture

Status: Active » Closed (fixed)

@ClearXSClearXS - setting $cookie_domain may cause that you will be logged out (happened to me many times, but this happens just once, straight after setting it). If you enter the correct password again, you should be able to log in back.

jday’s picture

interested in any response to #8 whiteley concerning the use of both domain access and ckeditor, for now I just leave the cookie domain unset

oakamit’s picture

When i tried to edit settings.php & saved it there was error[a fatal error or timeout occurred while processing this directive] as above-

open settings.php failed: Permission denied at cpanel line 4988
Carp::croak('open settings.php failed: Permission denied') called at /usr/local/cpanel/Cpanel/Fileman.pm line 1106
Cpanel::Fileman::fmsavefile('%2fhome%2fkonk5728%2fpublic_html%2fsites%2fdefault', 'settings.php', '<?php^M^J// $Id: default.settings.php,v 1.8.2.4 2009/09/14 12:59:1...', '', 1) called at cpanel line 4988
main::__ANON__('%2fhome%2fkonk5728%2fpublic_html%2fsites%2fdefault', 'settings.php', '<?php^M^J// $Id: default.settings.php,v 1.8.2.4 2009/09/14 12:59:1...', '', 1) called at cpanel line 1093
eval {...} called at cpanel line 1093
main::real_exectag(' main::dotag_finished_headers(' main::cpanel_parseblock(' main::cpanel_parse('GLOB(0xac48ed4)') called at cpanel line 5335
main::run_standard_mode() called at cpanel line 387

Steven Jones’s picture

Title: You are using a feature that requires $cookie_domain... Error » Where is $cookie_domain used?
Category: feature » support
Status: Closed (fixed) » Active

Apologies for re-opening, but trying to keep some context.

I'm coming from #994196: Add $cookie_domain directly in the settings.php template, since it will not work if defined in the included file..

CKEditor is complaining if the $cookie_domain variable is not set explicitly in settings.php but it seems that it never uses the $cookie_domain variable. I see a call to drupal_boostrap, which will invoke conf_init() which will then set the $cookie_domain if not already set (in filemanager.config.php).

So, my question is, is this check needed? If I don't set the cookie domain, does CKEditor still work?
If $cookie_domain is needed in the settings.php, do you know why? It appears that it shouldn't be.

anarcat’s picture

Title: Where is $cookie_domain used? » $cookie_domain not defaulted properly on CKFinder boostrap
Category: support » bug

From what I understand by reading this issue, it's because CKFinder bypasses the normal Drupal bootstrapping.

I do believe, however, that relying on a variable that *may* be defined in settings.php is a bug in that context. If you expect Drupal variables, you expect Drupal to be bootstrapped. If you bootstrap Drupal the wrong way, you're headed for a bunch of trouble, period.

The way the fix was proposed in Aegir was to add this line to the settings.php template:

$cookie_domain = $_SERVER['HTTP_HOST'];

I object to this change (edit: this change in aegir) on the ground that this work is already done by conf_init() (as found by Steven) in Drupal core itself.

If CKFinder doesn't bootstrap Drupal properly, it should at *least* default $cookie_domain properly, in the exact same way as above. It shouldn't be put on the users' shoulders to do that work instead of the module fixing its bootstrap code.

It could even be possible to load includes/common.inc and fire up conf_init()...

(I took the liberty of changing the issue title and type, I hope that's okay.)

wwalc’s picture

Assigned: Unassigned » dczepierga

Sounds interesting, also considering that enabling CKFinder is a nightmare for beginners at this moment, to check.

rex_the_first’s picture

Version: 6.x-1.x-dev » 7.x-1.6

Just a quick warning. I tried setting
$cookie_domain = $_SERVER['HTTP_HOST'];
and
$cookie_domain = www.mydrupalinstall.com
to sort out the CKEditor problem but both of these made logging in impossible. No Drupal user could log into the site (not even admin) and it was this thread that pointed me to cookie domain.
Any other solutions to this error message?

suganyaM’s picture

Hi,

If you have installed in your localhost,
$cookie_domain = 'localhost';

Or

$cookie_domain = '.mydrupalinstall.com'; //See the dot(.) before the domain name

Hope this might help you!!!!!!!

hschott’s picture

I'm having this same problem. If you set $cookie_domain then you can't log in. Has anyone found a solution?

rex_the_first’s picture

@ suganyaM

Thanks, the dot before the domain name sorted it, thanks.

hschott’s picture

I tried this and still get access denied. But even worse, when I put the old file back, I can log in, but get access denied on everything I try to do. This is so frustrating!

ryan.gibson’s picture

Worked for me.

developerweeks’s picture

I am having issues with ckfinder as well. I thought it might be my cookie setting also, but I find that my aegir server has cleverly added this code with comments:

/**
* We try to set the correct cookie domain. If you are experiencing problems
* try commenting out the code below or specifying the cookie domain by hand.
*/
if (isset($_SERVER['HTTP_HOST'])) {
$domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
// Per RFC 2109, cookie domains must contain at least one dot other than the
// first. For hosts such as 'localhost', we don't set a cookie domain.
if (count(explode('.', $domain)) > 2) {
@ini_set('session.cookie_domain', $domain);
}
}

Perhaps that will help others.
And as this seems to match all the instructions I have found, I am guessing my 403 denied error is caused elsewhere.
I have set my site's files/ folder with chmod 777
I have set the ckfinder's config.php to $baseUrl = '/files/';
Filesystem is public
I am getting:
It was not possible to properly load the XML response from the web server.
Raw response from the server:
403 Forbidden
nginx/1.0.5

I am out of ideas.

mkesicki’s picture

@developerweeks if I understood you correctly , this code is added to all your request ?
If yes, this code will be on top of output of CKFinder's XML response and this is the reason why it can't load response.

lunk rat’s picture

I added a local.settings.php file with the cookie domain line and it works. CkFinder still reports an error in Status Report, which makes my client freak out because they see "One or more problems detected with your Drupal installation" ... but CkFinder works.

Alan Warren’s picture

The problem continues, Nov 2012. Exactly the same error message as Feb 2010. To me tells me all I need to know about customer support. Guess who won't be purchasing CKFinder.

dkingofpa’s picture

@lunk_rat I did the same thing with a local.settings.php file and $cookie_domain. Everything works, but the Status Report page still says I don't have the module properly configured. After seeing that someone else had the same problem, I've concluded this is a module bug and not my error.

dczepierga’s picture

@dkingofpa, try to use last DEV version - i fix there all problem with paths in CKEditor module, so this should be also fixed.

Greetings

bdavis113’s picture

I am putting in my domain name with the . before it,

This is what I am putting in:
$cookie_domain = '.http://anchorchristianchurch.org';

and I am getting the following message when I go to save:
Could not open /home/anchorch/public_html/sites/default/settings.php for writing: Permission denied

wwalc’s picture

1. Do not include "http://" in $cookie_domain
2. settings.php is set to readonly by Drupal itself, try chmodding to 666, see this article

wwalc’s picture

Assigned: dczepierga » Unassigned
bdavis113’s picture

thank you that got that part to work.

after that I still do not get the ability to browser server to upload images, when I click on the image icon to put an image on a page? any idea what I might have done incorrectly?

As you can tell I am very new to code, but I am picking it up pretty quickly.

I have put the settings to 777.

Thank you.

wwalc’s picture

Make sure to follow the README, e.g. :

3. Grant the "CKFinder access" permission in the "Administration panel > People > Permissions" section.

6. Select CKFinder as a preferred file browser in the
"Administration panel > Configuration > Content Authoring > CKEditor" section
(for a selected CKEditor profile scroll down to the "File browser settings" section).
In the "File browser settings" section you may also change destination folders for files uploaded with CKFinder.

bdavis113’s picture

I am unable to find the readme file in my ckfinder files anywhere, I have been looking for 3 days to find it. I do not see ckfinder as stated in #3 above. I already had #6 set as stated.

mkesicki’s picture

pirash’s picture

The following line will do the magic, even if you have a multi-site setup using domain access module. This will take care of the domain switch and resolves the CKFinder issue. :)

pirash’s picture

The following line will do the magic, even if you have a multi-site setup using domain access module. This will take care of the domain switch and resolves the CKFinder issue. :)

$cookie_domain = $_SERVER['SERVER_NAME'];

bdavis113’s picture

ok, I redid that, now I am getting a file browser disabled for security reasons. but I think I noticed that somewhere else in the feed above, so I will look for that. thank you for your patience and guidance. this has been a huge help and learning experience for me. it is much appreciated. thank you all.

net55’s picture

ckeditor fix that worked for me, thx all.
had to set the permissions for (sites/default/settings.php) settings.php to 666 in a ftp program
For some reason my host resets the permissions every hour or so for this file...this threw me off for a while!

$cookie_domain = '.mydomainname.com';
uncomment it (removed the # in front of: # $cookie_domain = 'example.com';)

net55’s picture

Issue summary: View changes

updated issue description to match the real problem to be solved

R-H’s picture

I'm on a hosted Aegir platform from Omega8. The cookie_domain setting is in the global.inc file. Can CKEditor take the cookie_domain setting from there?

R-H’s picture

I've also tried to place the cookie_domain setting in the local.settings.php file and it doesn't work. Can't browse my files but can upload a file. Get the error message on the status page.