Apache Shindig PHP Setup Problem Solved

First things first. Shindig is an Apache incubator project that serves as an OpenSocial Container and…I’m already falling asleep. Too boring. I’m way behind the curve on all things “social networking” but I have an idea for an app that may scratch an itch I have, and it just happens that some of this social networking stuff might be a good way to jump start the idea. So that means catching up on a couple of years (or more) of stuff that’s been going in the world of web 2.0, which includes OpenSocial. I wanted a local OpenSocial test sandbox and found Shindig to fit that bill.

Now, onto the problem I was running into and the solution. Unless you want the long boring details, I can save you the trouble and tell you to make sure you have mod_rewrite enabled in Apache.

If you haven’t dozed off by now then it probably means you’re running into issues with the Shindig PHP setup and would like some more details. I followed the directions on setting up the PHP Shindig server on my laptop running Kubuntu 08.04 here at home and kept getting a 404 error. I thought that was strange since I could hit other files with my browser that I put in that directory manually for testing but not the Shindig index.php page. Turns out the Shindig index.php page tries to be more “controller/servlet” like by sniffing the URI and passing it along to the appropriate handler. If it can’t find a match, then it gives a custom 404 error. I noticed the test URI (http://shindig/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml) didn’t have any reference to index.php. Ah yes, the wonders of Apache mod_rewrite! And guess what I didn’t have enabled? Yep, Apache mod_rewrite. So, below is what I did to get things running on an Ubuntu setup from scratch (meaning no Apache 2, PHP 5 was installed or configured):

sudo apt-get install apache2 apache2-common apache2-mpm-prefork apache2-utils ssl-cert libapache2-mod-php5 php5-cli php5-common php5-curl php5-mcrypt

svn co http://svn.apache.org/repos/asf/incubator/shindig/trunk/ /home/jhoover/dev/shindig

sudo mv /etc/apache2/mods-available/rewrite.load  /etc/apache2/mods-enabled/

sudo cp /etc/apache2/sites-enabled/000-default /etc/apache2/sites-enabled/shindig

sudo pico /etc/apache2/sites-enabled/shindig

Stop laughing, I use the Pico text editor. I’m, as my son would say, “weak sauce”. I know. Anyway, here’s what I have in that virtual host file:

NameVirtualHost *
<VirtualHost 127.0.0.1:80>
  ServerAdmin webmaster@localhost
  ServerName shindig

  DocumentRoot /home/jhoover/dev/shindig/php
  DirectoryIndex index.html index.php
  <Directory />
    Options FollowSymLinks
    AllowOverride All
  </Directory>

  ErrorLog /var/log/apache2/error.log
  LogLevel warn

  CustomLog /var/log/apache2/access.log combined
  ServerSignature On
</VirtualHost>

Once we have that in place, we need to edit our host file:

sudo pico /etc/hosts

Append the following to the hosts file and save:

127.0.0.1       shindig

Time to restart Apache:

sudo /etc/init.d/apache2 restart

Now you should be able to go to your web browser of choice and run the demo/test app:

http://shindig/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml

If all went well you should see something a little like this:

Leave a comment