Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
I am trying to instal KCFinder in a new Couch site, but am having trouble trying to get it to work.

I have done the following:

1) downloaded the KCFinder archive from the forum, extracted it, and placed it inside my 'couch/includes' folder

2) in my 'config.php' I have set 'K_USE_KC_FINDER' to '1'

3) I also specified a custom upload folder, and have set its location appropriately in config.php ('K_UPLOAD_DIR').

I defined an 'image' field in one of my templates, and when I click on it, a file-manager-like dialog box shows up, but it doesn't allow me to do anything: clicking on any of its buttons yields the following dialog box:

Screen Shot 2014-07-09 at 5.17.22 pm.png
screen-shot-kcfinder-msg
Screen Shot 2014-07-09 at 5.17.22 pm.png (52.3 KiB) Viewed 3685 times


Right now the site is running locally on a MAMP setup - this means that Apache and MySQL are setup using non-standard ports. I am accessing the site using the latest version of Safari.

I get the same message, whichever button I click. It's like KCFinder is requesting Safari to open a custom URL that it cannot identify, and it then asks me to find a suitable program to open it with...

Am I making a really silly mistake? Any assistance would be greatly appreciated.
@luxlogica,

This error has never been reported before.
MySQL/Apache running on non-standard ports is pretty common with local installations so that is unlikely to be the cause.

I am sorry but I have no clue as to what could be causing this and will need to take a look at the problem first-hand to know any better.

That, of course, is out of question as your site is not yet online.
So, I am really sorry but there is little I can offer you as help in this case.

I am sure you'll understand.
Once your site gets online however, things would be different as I can then login and try to troubleshoot the issue (in the unlikely case that it crops up even then).

Thanks
The JavaScript is failing for one reason or another. Could you check that the issue detailed in viewtopic.php?p=14597#p14597 is not a factor? You should also visit KCFinder directly (http://localhost/couch/includes/kcfinder/browse.php?cms=couch&type=image) and check for JS errors in the browser developer console.
@kk and @cheesypoof, thank you for your feedback, and assistance.

Following up on cheesypoof's suggestions:

1) I have checked the 'couch/includes/kcfinder/js/browser' directory, and there are no stray dot files there.

2) Visiting KCFinder directly, the javascript console does produce an error - the stack trace is:
Code: Select all
[Error] TypeError: 'undefined' is not an object (evaluating '$('#order input[value="' + _.kuki.get('order') + '"]').get(0).checked = true')
   initSettings (joiner.php, line 2062)
   init (joiner.php, line 1489)
   (anonymous function) (browse.php, line 32)
   resolveWith (jquery.js, line 16)
   ready (jquery.js, line 16)
   z (jquery.js, line 16)

This is before clicking on any buttons. I have no idea what the javascript code is doing, or why it's failing there - my js skills are not good enough for me to do code archaeology.

I have Googled, and also searched in KCFinder's own website, as well as in its GitHub repo, but cannot find any hints as to where to go from here.

I don't feel comfortable about posting a bug report in GitHub just yet, for a couple of reasons: I am fairly certain the error is something particular to my setup, and also, the version of KCFinder we are installing is not the latest...

Is there anything else you guys can suggest for me to try? Any guidance would be greatly appreciated.
Ok, guys, I managed to find the reason for the issue: it was, indeed, the custom ports that made KCFinder break.

MAMP uses ports 8888 for http, 8890 for https, and 8889 for MySQL in its default installation. If I change these to the default 80, 443 and 3306, KCFinder works. Note, that what is causing the problem is very likely to be simply the Apache ports (8888 and 8890), and the port used by MySQL is probably irrelevant.

I am recording the solution here, in case it helps others.
Hi luxlogica,

It was not clear to me from the first error message you reported but the error stack in your next post was familiar as I have encountered it before.

As you found out, the problem is indeed the non-default web-server port.

If one cannot change the port to its default, the problem can be rectified doing the following -
1. Go to /couch/includes/kcfinder/config.php
2. Find the line 'cookieDomain' => ""
3. Write here address WITHOUT port, i.e. 'cookieDomain' => "www.yoursite.com"

I think if you have not set a domain for your local installation, 'localhost' should work as well (not sure if IP address will work).

Please try this and let us know.

Thanks.
@kk, thank you for you always excellent support.

It was easy enough for me to change the ports to the standard Apache ones - and these are the ports that will be used in the production site, anyway, so this is perfectly fine by me!

If you still want me to try out adding the domain directly to the config, let me know, and I'll do that for you.

Once again, thank you for your amazingly friendly and helpful support. It's truly appreciated.
You are welcome, @luxlogica :)
If things are already working for you, please don't bother to change the settings just to test things out.

I've edited the title of this post to add the non-standard port part - might help others who happen to run into the same problem.

Thanks
8 posts Page 1 of 1