Phurl Powers ILV.ME

Sometimes 140 characters just isn’t enough room to express our thoughts, activities, quotations, recipes, tutorials, diatribes, announcements, affections, tips and lessons. Our most valiant attempts at compendium often extend beyond the limitations imposed by Twitter. The solution is quite simple: all a tweeter has to do is include a URL to point to a blog post, photo or video.

But, what if the URL is too long?

This URL is 176 characters: http://www.amazon.com/gp/product/1416594787/ref=s9_intb_gw_tr02?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=1Q4Z3EN485H4KY6HXSVS&pf_rd_t=101&pf_rd_p=470938631&pf_rd_i=507846

URL shortening services have sprung up to satisfy the burgeoning need for shorter links. They accomplish this by storing lengthy URLs in a database table with a corresponding alias. When a user points to the shortened URL the longer link is fetched from the database and the user is automatically redirected.

While perusing tweets I noticed Justin Russell had posted a link using a short domain that looked close to his own name, http://jusr.us/. Upon inquiry he pointed me to an open source PHP URL shortener called Phurl.

I found and registered the shortest URL I could find, http://ilv.me/ (I love Maine). Next, I downloaded the 2.0.0 beta version of Phurl and installed the files to a new directory on my web server. Then I created a MySQL database and built the requisite tables with the included SQL file. Finally, I configured the files as necessary.

Unfortunately, it didn’t work. After many failed attempts to find the problem and much research I contacted Phurl’s developer, Hidayet Dogan. I was pretty sure at least one problem was with the .htaccess file. Hidayet had me remove two lines from the beginning of this file, but it still didn’t work. When he asked me to check the Apache log files I contacted my host, 1and1. They said that their Apache assumes all .php files are PHP4 and .php5 files are PHP5. They helpfully pointed me to a workaround, which I implemented.

It still didn’t work, but I knew I was getting closer because the error message changed. Instead of an “Internal Server Error (500)”, I was getting a message which identified the error and directed me to the problem file and line number. A boolean true statement had a $ prefix and, therefore, looked to PHP like an undefined variable. I removed the $ and everything was fixed. Voila!

The long URL above is now, succinctly: http://ilv.me/greatestshow

Those minor problems should be expected when testing beta software. I hope my efforts contributed to improving the new version. The files available for download have already been modified by Hidayet. I learned a lot about Apache .htaccess files, regular expressions and redirection.

Thank you to Justin Russell, Hidayet Dogan and 1and1.

*Update July 22, 2009*

I got an email from Hidayet saying that there shouldn’t be a problem with PHP4/5 configuration. I removed the line 1and1 suggested I include in my .htaccess file and it still works. Hmmmm. Apparently it isn’t necessary, but it was the only change made before the “Internal Server Error (500)” message went away. *scratches head*

I’m just glad it works.

1 Comment

  1. Phurl seems to be abandoned. Since publishing this post I let ownership of ilv.me go. A few days ago I was finally able to register it again and have, again, set up a shortener with it. This time I used YOURLS, which was dead simple to set up.

    I simply created the site in the Webfaction admin, created a database, cloned the files to the new app directory from GitHub, copied the config file and added the necessary info to it, then visited the page and clicked the Install button. Voila!

    http://yourls.org/

Leave a Reply