Bonnaroo!!

Well, I did it... I purchased tickets to Bonnaroo 2008!! So, it looks like I will be going to Manchester, TN for 4 days of musical bliss with some of my very close friends. If you want to join us, I would recommend getting tickets sooner then later!

Update (2008/02/18): Well, Titus decided to nut up and join us! Who else is coming??

CodeIgniter + XAMPP (0.7.1) + OS X Setup Guide

Having a decent development environment is important for any developer, and getting CodeIgniter and XAMPP setup on OS X (or any platform) is a snap! Sure, OS X ships with Apache, but I really like the stand-alone style of XAMPP. Plus, since XAMPP is cross platform, I can easily move my environment between platforms and minimize the need to re-configure anything.

First a little background though. The XAMPP project is a wonderful bundle created by the Apache Friends. It includes Apache, MySQL, PHP and Perl. For PHP, it includes both PHP4 and PHP5, and also ships with PHPMyAdmin for administering the MySQL server. Basically, it lives in a single directory and doesn't need to be "installed". For Windows users this is a huge plus (refer to XAMPPLite).

The CodeIgniter (CI) project is intended to be a very lightweight, highly extendable MVC frakework for PHP4 and PHP5. Sure, there are other frameworks out there such as CakePHP, but I prefer CI due to it's incredible documentation and because I feel it is more lightweight.

Go ahead and download CodeIgniter and XAMPP for OS X if you do not already have them. I prefer to checkout CodeIgniter from the SVN; you can read instructions on doing that here. Once you have both of the packages, start by installing XAMPP. For OS X users, I opted for XAMPP MacOS X (tar) 0.7.1. To get this going, run the following command:

$ sudo tar xfvz xampp-macosx-0.7.1.tar.gz -C /

This will extract the tarball into /Applications/xampp/. Following the CI SVN article on Derek Allard's site, I checked out CI #844 into /Users/ldavison/sandbox/ci_844/ using svnX. As you can see, I have put my CI source into a directory that is non-public to my XAMPP installation. In fact, this is one of the most parts of the setup in my opinion; making sure CI is outside the web servers DocumentRoot. Of course, a lot of the CI source has this in the top of the files:

<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

However, I still feel it's better if the files aren't in a public directory to begin with avoiding any direct access to the source.
The next thing is to copy the index.php file into the DocumentRoot, in fact it's the only file in the CI code that needs to be publicly accessible.

$ sudo cp /Users/ldavison/sandbox/ci_844/index.php /Applications/xampp/htdocs/. $ sudo vim /Applications/xampp/htdocs/index.php

In the index.php file, edit the path to the system folder, in this case:

$system_folder = "system";

becomes:

$system_folder = "/Users/ldavison/sandbox/ci_844/system";

In order to get XAMPP to use mod_rewrite and read the configuration from a .htaccess file, the /Applicatons/xampp/etc/httpd.conf file needs to be updated. Look for the section:

<Directory "/Applications/xampp/xamppfiles/htdocs">

In here there will be a line that reads:

AllowOverride AuthConfig

Change that to read:

AllowOverride AuthConfig FileInfo

Restart the servers in XAMPP, by running:

$ sudo /Applications/xampp/xamppfiles/mampp restart

Alternatively, you could find out the PID of the apache process owned by root and kill -HUP it. That will force Apache to reload it's config:

$ ps aux | grep httpd
nobody   51504   0.0  0.1   103016   1220   ??  S

     3:38AM   0:00.00 /Applications/xampp/xamppfiles/bin/httpd -k start -DSSL -DPHP5
nobody   51503   0.0  0.1   103016   1220   ??  S

     3:38AM   0:00.00 /Applications/xampp/xamppfiles/bin/httpd -k start -DSSL -DPHP5
nobody   51502   0.0  0.1   103016   1220   ??  S

     3:38AM   0:00.00 /Applications/xampp/xamppfiles/bin/httpd -k start -DSSL -DPHP5
nobody   51501   0.0  0.1   100384   1252   ??  S

     3:38AM   0:00.00 /Applications/xampp/xamppfiles/bin/httpd -k start -DSSL -DPHP5
root     51454   0.0  0.4   103016   7596   ??  Ss

    3:38AM   0:00.24 /Applications/xampp/xamppfiles/bin/httpd -k start -DSSL -DPHP5
nobody   51506   0.0  0.1   103016   1220   ??  S

     3:38AM   0:00.00 /Applications/xampp/xamppfiles/bin/httpd -k start -DSSL -DPHP5
nobody   51505   0.0  0.1   103016   1220   ??  S

     3:38AM   0:00.00 /Applications/xampp/xamppfiles/bin/httpd -k start -DSSL -DPHP5

 

$ sudo kill -HUP 51454

That should kill all the child processes (owned by nobody) and re-spawn them with the updated httpd.conf file. If the web server is not running, double check that the configuration added was correct. You can look at the error_log to see why Apache failed to start with the updated configuration by running:

$ tail /Applications/xampp/logs/error_log

Once the httpd.conf file has been updated properly and Apache successfully reloaded, add the below to /Applications/xampp/htdocs/.htaccess. That will tell Apache what the rewrite rules are for mod_rewrite in the htdocs directory, which will remove index.php from your URI. For instance, http://localhost/index.php/controller/action will become http://localhost/controller/action.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>

    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule> 

 

Alternatively, you can add the above to the <Directory "/Applications/xampp/xamppfiles/htdocs"> section, but for development (why we're using XAMPP to begin with) I prefer using .htaccess so I don't have to restart Apache to alter certain configurations. You might want to re-think this in a production environment, of course checking with your system administrators is always best.

At this point, everything should be working properly and you should have a fresh new development environment setup! So, get after it, write some code! Free free to hit me up with any questions or comments.

Finally Live!

And we're off! It's been really cold here lately (like -20 or colder), so I finally got some spare time to push the new layout and site to production. Please let me know if you run into any issues.

I will be going back through previous posts and selecting categories in the near future as well. Until then, feel free to use the site search to find what you're looking for!

New Site!!

It is finally time! It's definitely been a while, but I felt it was time to get off my lazy ass and do a serious make over on my site. I did run into a few challenges along the way, the biggest was porting my existing posts from Blogger.com and into my own home-grown CMS that you see today.

After doing some searching around for ways to backup a Blogger.com site, I ended up going with the recommended way I found in the Blogger.com help site. By changing my template and exporting the posts as a new file. I chose my own format for the file though, using a generic XML format. In about an hour I had an XML parser that would add each of the entries into my new schema.

One of the other challenges was actually working with a new framework, or one that was at least new to me. I ended up rolling with Code Igniter, as I found it extremely flexible and lightweight. There are still a few things however that I'd like to add to this site, but for now I feel like it is at least beta quality. Since my site is relatively small isn't a heavily hit site, I felt beta quality was good enough to release.

 Over the next few months, I plan to finish up the things left out when I have some time. One thing is an archive. Although, I'm not sure exactly how necessarily this is with the search functionality. Previously, I didn't have search available, so we'll see how it goes for now. I might add the archive stuff back in.

I have also slimmed down the flickr integration and also improved the caching. This will mean that load times will drastically improve. In the future I will be adding my photo sets back into the mix, but for now it's just my photo stream straight up.

I've also decided to add captcha throughout my site. This specifically effects two areas, comments and the contact form. I didn't get that many spam posts on my previous site, but I'm hoping this will reduce that number even more.

If you have any feedback on the site so far, please let me know!

Been a while...

Just like the title says, it's been a while since my last update; a long while. After traveling for work so much last year, this year I've fortunately spent home with family and friends. It's been a great year so far!

Anyways, I'll keep this short. This site will be undergoing a make over soon. I've been trying to put together a new site in any free time I can spare (which is little). It will be a major improvement over what is here today. This site is currently using blogger.com as it's backend along with Flickr. I've decided to keep Flickr as the backend for my photography, since Flickr is awesome. However, the decision to drop blogger.com has been made.

Instead, I will be rolling my own, plus it will give me a chance to sort of start over. There is a lot of crap on this site that no longer reflects who I am or what I stand for. Hopefully the new site with a fresh back end will be ready for launch by the end of the year.

Until then, feel free to check out my Flickr page for more recent updates.