Shindig on PHP – Getting started

By Anash P. Oommen




Shindig is a new project in the Apache Software Foundation incubator and is an open source implementation of the OpenSocial specification and gadgets specification. Details of Shindig can be found at


Shindig is currently available in Java and PHP. The following article explains how to setup the PHP version of Shindig on your windows machine.


Downloading Shindig


Shindig does not have a downloadable version yet, so you will have to get the source code directly from the repository. To get the code directly from repository, you need to have a subversion client installed in order to checkout the code. Instructions for downloading and installing Subversion can be found here:


Once you have the svn client, perform the following steps:


  1. Open a command prompt in C:\ directory.
  2. Type the following commands at the command prompt:


    1. mkdir shindig
    2. cd shindig
    3. svn co .


If everything went fine, you should have the entire shindig distribution in your C:\shindig directory.


Installing Apache and PHP


Shindig runs on PHP 5.2.x and Apache, so you need a PHP + Apache configuration up and running. I will assume for the rest of this article that these applications are not installed on your machine.


There are several easy-to-install PHP – Apache distributions available on the internet. I have used the XAMPP distribution. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use. A setup for windows can be found at Once you download the setup, run it and follow the setup instructions to have Apache and PHP running on your machine. If you have any doubts, you could watch this video on youtube : I installed XAMPP at C:\Program Files\xampp, and will be using this path for further discussions in this article.


Once you have completed the installation and started Apache web server, make sure that everything works by going to http://localhost/. You should get a page like this:

Installing PHP extensions


Shindig requires json, simplexml, libxml, mcrypt and curl extentions enabled. To check if your PHP installation has the required extensions, you have to load your phpinfo() page.

To view the phpinfo() page in XAMPP installation, you have to open http://localhost on your web browser, and click the phpinfo() link on the left side of the page. This will bring up the phpinfo page, which is similar to this:



You can scroll down to see the various plugins installed on PHP. XAMPP comes with all the 5 required extensions, but all of them may not be enabled by default. Take a note of the missing PHP extensions.


Now, open the file C:\Program Files\xampp\apache\bin\php.ini in Notepad. Look for the following lines:





Uncomment these lines by removing the ; before these lines. Restart Apache. Now refresh the phpinfo() page to make sure that all the 4 required extensions are loaded.


Note: If you have your own distribution of PHP and Apache installed on your machine, and want to install these extensions, then you can get download and configuration instructions from website.

Installing Apache Extensions


Shindig requires mod_rewrite plugin to work properly. To check if this module is installed, open your apache httpd.conf file. On my machine, it is available at C:\Program Files\xampp\apache\conf\httpd.conf. Open this file, and look for a line like this:


LoadModule rewrite_module modules/


Uncomment this line by removing the # before this line. Save and close the file. Restart Apache.


Setting up Shindig Server


Copy the C:\shindig folder to your htdocs folder. In my case, it is C:\Program Files\xampp\htdocs. Go to htdocs/shindig/php folder. Create a file named .htaccess and add the following lines in it:


<IfModule mod_rewrite.c>

      RewriteEngine On

      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule (.*) index.php [L]



Save and close this file.


Shindig's PHP version depends on mod_rewrite to redirect all the HTTP requests to be redirected to index.php (except in cases where the file already exists, or the request is for a folder), and the rewrite script above ensures that

Note: If you get the latest version of Shindig (June 14, 2008), this will already be in place.

Now, open the file htdocs/shindig/php/config.php in Notepad. Look for a line that says


'web_prefix' => '’,


Change this line to


'web_prefix' => '/shindig/php',


The web_prefix key tells shindig how much part of the url is to be ignored while processing the file(s). Since my shindig php folder is htdocs/shindig/php, my web_prefix is /shindig/php.


Now, open htdocs\shindig\config\container.js in Notepad. Look for a line towards the end of this file that says


"opensocial-0.7" : {

    // Path to fetch opensocial data from

    // Must be on the same domain as the gadget rendering server

    "path" : "/social/data",


Modify the “path”, so that it reads like:


"opensocial-0.7" : {

    // Path to fetch opensocial data from

    // Must be on the same domain as the gadget rendering server

    "path" : "/shindig/php/social/data",


Again, /shindig/php corresponds to the text you added in web_prefix. Save and close container.js. Now, open a web browser and navigate to http://localhost/shindig/php/gadgets/files/samplecontainer/samplecontainer.html. If everything went fine, you should see a page like this: