Koken – API Error. The theme is not able to make contact with your Koken installation.

I ran Koken as a photo gallery for my personal website under a Godaddy hosting.  Worked well.  But at some point I decided I needed my own “external” server for troubleshooting purposes, to help with my day-to-day System Admin job. Something outside of our corporate network so I can see if things are accessible from the outside. So I got myself a VPS from 1and1, running Windows 2008 R2.  With that I figured I move this blog, my business webpage, as well as my personal webpage to the VPS.  I’m running the webpages on IIS.

So I recreated my personal webpage and reinstalled the Koken. The install to Koken went swimmingly. No problem connecting to the database. The admin page launches with no issues.  However, when I try to visit the page, I get the dreaded “API Error. The theme is not able to make contact with your Koken installation. Contact your host to see if they are blocking loopback connections.”

Now I’m not a coding expert so I’m not sure where to look. But I started from scratch and checked the Koken requirements.  I did notice that I did not have the iMagick module so I got that to work first by following the entry by FDIM here.  After that, the iMagick module showed up under phpinfo(). But that did not help my API Error.

After alot of trial an error, I hit upon this post within Koken’s help itself.  There, the user Pascal talks about what is going on with the backend requests and it gave me the idea to simply modify the whole ” curl_setopt($curl, CURLOPT_URL, self::$protocol . ‘://’ . $host . self::$location[‘real_root_folder’] . ‘/api.php?’ . $url);”  section in koken.php. Rather than have the function try to determine where the api.php is, I hardcoded it:

curl_setopt($curl, CURLOPT_URL, ‘http://www.domain-name.com/koken/api.php?’ . $url);

Where www.domain-name.com is replaced with your own domain name. This assumes you have Koken installed in a koken subfolder off of root and the api.php is located there. (The koken.php is located in the koken\app\site\ folder – make a copy of the file before you begin editing, just in case).

Save that modified file and bingo! That’s it!  No more API Error.

I was racking my brain for two days on this.  Hopefully it will save someone else some time and trouble.

Leave a comment