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.

Increase the Max_Input_Vars in PHP For IIS WordPress Install

Installed WordPress for a client, they wanted a particular theme. The theme has some sort of Server Health page which showed the Max_Input_Vars was set to 1000 and it was recommending to go higher. I searched hi and lo for  how to change it. All the websites I hit said add a php.ini with the settings you want or update the .htaccess file.  Neither worked.  But what did work was this (if you’re running wordpress on IIS):

  • Open up Internet Information Services (IIS) Manager
  • Select the server name in the left side Connections pane
  • In the Features View, select PHP Manager

  • Click on Manage all settings

  • In the Filter box type max_input_vars and hit Go

  • Right-click the max_input_vars and select Edit
  • Change the value to whatever you want (I set it to 3000), then hit OK.

That’s it!  You can verify by creating a test.php file with the following line:

<?php phpinfo(); ?>

Open up that test.php page in a browser. There, search for the max_input_vars and it should show you the updated value.