Setup a local configuration file in Codeigniter

Even if you have twenty local environments on //one freaking computer//, this technique still works :)After four years of development, I’m still a big CodeIgniter fan, although some other frameworks are starting to look mighty interesting.  Despite the bugs in Version 2.0.2, however, CI is heading in the right direction.

One CI-related issue that has caused problems for my workplace in the past has been the ability to setup distributed development environments.  Everybody has a different local setup, and some of the configuration directives inside of CI’s application/config folder must change from machine to machine.

Of course, we can’t just tell Mercurial to ignore that folder during commits, because there are some configuration directives that should remain the same across all environments, such as language, charset, enable_hooks, etc.

So, how to make some configuration settings consistent across different computers, and how to make some local settings?
Read more

CodeIgniter on the Command-Line

Credit: http://www.flickr.com/photos/ripton/So, yesterday, I spent a few hours trying to create a robust command-line interface for one of my CodeIgniter applications.  I learned a lot about PHP-CLI.  I also came to remember why it’s a bad idea to try and fit a round peg in a square hole.

The thing is, CodeIgniter is a great little web framework.  See the key word in that sentence?  Yes, you can hack some CLI functionality in, but if you want to start doing fancy stuff like adding multiple levels of interactive menus and such, then its time to rethink what you’re doing.

On the other hand, there are many reasons to create a simple CLI-interface to your web application.  The main use would be for running of maintenance tasks and automated CRON scripts.  For this kind of task, it’s very easy to create a CLI entry-point for your app.

Read more

CodeIgniter Preflight Checker

preflight_checkIn my last post, I discussed do’s and don’ts for making a PHP application portable. This week, I will show you how to create a preflight checker in the CodeIgniter PHP framework to ensure that an environment will support your application.

Read more

Making PHP Applications Portable

portable_computer_guy“Portable” means that your application is able to run on any PHP webserver with minimal fuss.

Ensuring portability is an absolute must for programs that are packaged and distributed for public consumption, like WordPress or MediaWiki.  But, you should aim for portability in all of your applications.  The ideal is a one or two-step installation process and only two or three system requirements:  1. Webserver (IIS/Apache/etc), 2. PHP v5.X+, 3. MySQL 4+.

Read more

Better Tag Cloud