Answers.Body: <p>My mistake, I left a hack in civicrm.settings.php (and forgot it, it was months ago) which led to this weird behavior. Reverting the hack solves the problem :</p>
  
  <pre><code>// can't remember why I did this 18 months ago, but this is obviously a bad idea...
  //require_once './sites/all/modules/civicrm/CRM/Core/ClassLoader.php';
  require_once 'CRM/Core/ClassLoader.php';
  </code></pre>
  
  <p>Many thanks to XDebug, and lesson learned (again :) about hacking CiviCRM code... </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-27T07:00:33.810Z
Answers.LastActivityDate: 2016-09-27T07:00:33.810Z
Answers.UserDisplayName: Florian Motteau
Body: <p>I get an error 500 when trying to upload an image to server in CKEditor (for example when using print/merge document action), when the KCFinder new window opens. The URL called is :</p>
  
  <p><a href="https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php?cms=civicrm&amp;type=images&amp;CKEditor=html_message&amp;CKEditorFuncNum=0&amp;langCode=fr" rel="nofollow">https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php?cms=civicrm&amp;type=images&amp;CKEditor=html_message&amp;CKEditorFuncNum=0&amp;langCode=fr</a></p>
  
  <p>I thought about a https related problem, but this URL :</p>
  
  <p><a href="https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/" rel="nofollow">https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/</a></p>
  
  <p>...is working fine and opens the KCFinder file browser.</p>
  
  <p>Does anyone encountered this problem ? I can't reproduce it on demo site, I am running CiviCRM 4.7.10 with Drupal 7.50. I don't have anything in Apache logs.</p>
  
  <p>I suspect a file / folder permissions issue too, does anyone have an idea on what is going on ?</p>
  
  <p>Thank you</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I was able to open the file browser using this URL :</p>
  
  <p><a href="https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php??cms=civicrm&amp;type=images&amp;CKEditor=html_message&amp;CKEditorFuncNum=95&amp;langCode=fr" rel="nofollow">https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php??cms=civicrm&amp;type=images&amp;CKEditor=html_message&amp;CKEditorFuncNum=95&amp;langCode=fr</a> (note the "??" just after "browse.php")</p>
  
  <p>...but </p>
  
  <p><a href="https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php?cms=civicrm&amp;type=images&amp;CKEditor=html_message&amp;CKEditorFuncNum=95&amp;langCode=fr" rel="nofollow">https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php?cms=civicrm&amp;type=images&amp;CKEditor=html_message&amp;CKEditorFuncNum=95&amp;langCode=fr</a> (only one "?" after "browse.php") still gives me an error 500.</p>
  
  <p>very confusing...</p>
  
Tags: <kcfinder>
Title: Error 500 with KCFinder in CKEditor
ThreadText: # Error 500 with KCFinder in CKEditor
  
  (Asked by: username_0 on 2016-09-12)
  
  I get an error 500 when trying to upload an image to server in CKEditor (for example when using print/merge document action), when the KCFinder new window opens. The URL called is :
  
  <https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php?cms=civicrm&type=images&CKEditor=html_message&CKEditorFuncNum=0&langCode=fr>
  
  I thought about a https related problem, but this URL :
  
  <https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/>
  
  ...is working fine and opens the KCFinder file browser.
  
  Does anyone encountered this problem ? I can't reproduce it on demo site, I am running CiviCRM 4.7.10 with Drupal 7.50. I don't have anything in Apache logs.
  
  I suspect a file / folder permissions issue too, does anyone have an idea on what is going on ?
  
  Thank you
  
  **EDIT**
  
  I was able to open the file browser using this URL :
  
  <https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php??cms=civicrm&type=images&CKEditor=html_message&CKEditorFuncNum=95&langCode=fr> (note the "??" just after "browse.php")
  
  ...but
  
  <https://subdomain.mysite.com/sites/all/modules/civicrm/packages/kcfinder/browse.php?cms=civicrm&type=images&CKEditor=html_message&CKEditorFuncNum=95&langCode=fr> (only one "?" after "browse.php") still gives me an error 500.
  
  very confusing...
  
  **Tags:** kcfinder
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-09-27. Score: 3 | Accepted answer
  
  My mistake, I left a hack in civicrm.settings.php (and forgot it, it was months ago) which led to this weird behavior. Reverting the hack solves the problem :
  
  ```
  // can't remember why I did this 18 months ago, but this is obviously a bad idea...
  //require_once './sites/all/modules/civicrm/CRM/Core/ClassLoader.php';
  require_once 'CRM/Core/ClassLoader.php';
  
  ```
  
  Many thanks to XDebug, and lesson learned (again :) about hacking CiviCRM code...
  
  
  ---
  
  