Installing PHP is a relatively simple task one would think. Indeed it is simple, but configuring the php.ini isn’t; at least not so on Windows Vista! It is infuriating when such a relatively simple task is made inordinately complicated because of the nuances of Vista permissions. What started out as a 5 minute task took a significant number of hours searching for a suitable answer on Google, and not only by myself.

The task I was trying to achieve was the installation of development versions of WordPress, Drupal, MediaWiki and Moodle, all of which would require a MySQL database. Trying to load the MySQL extension should have been a simple case of uncommenting the line in the php.ini and restarting the Apache service. With Vista, this was certainly not the case.

I set up a very simple page detailing the php configuration in an index.php file:

< ?php phpinfo(); ?>

This showed me the default configuration path of my php.ini and extensions directory, amongst a whole host of other information.

In both cases the paths were incorrect. First and foremost the configuration file path stated C:\Windows when in fact I had installed it in the root (C:\PHP5). So, although I was amending the php.ini file with the correct detail, Vista was using the default values. If there is no php.ini file in Windows, then you’ll continue banging your head against a brick wall.

The problems didn’t stop there. Moving the php.ini file to the Windows directory under Vista isn’t a simple copy and paste task. You need to be administrator. But Vista’s administrator priviledges are more pseudo than actual! In order to amend and save the php.ini file in the Windows directory, you must run Notepad as administrator and save the file as such. Voila! Everything then works. The phpinfo() function returned the correct installation detail and I could continue with the job I was meant to be doing.

PS. Thanks to Rob Douglas for his help.

Occam’s Razor (also spelled Ockham’s razor) is a principle attributed to the 14th-century English logician and Franciscan friar William of Ockham.

Occam’s razor states that the explanation of any phenomenon should make as few assumptions as possible. The principle is often expressed in Latin as the lex parsimoniae (law of succinctness):

entia non sunt multiplicanda praeter necessitatem

which translates to:

entities should not be multiplied beyond necessity

This is often paraphrased as “All things being equal, the simplest solution tends to be the best one.” One consequence of this methodology is the idea that the simplest or most obvious explanation of several competing ones is the one that should be preferred until it is proven wrong.

So, how can this apply to web development. There is an analogy between software development and the scientific theory as a means to enhance the credibility of a particular set of programming practices. Once a programmer has a theory (model) of the software in their head, they can talk about and explain its behavior to others. When they make changes to the code, they do so in a way that is consistent with the theory and therefore “fits in” with the existing code base well. A programmer not guided by such a theory is liable to make modifications and extensions to the code that appear to be “tacked on” as an afterthought, and not consistent with the design and philosophy of the existing code base.

Simply, don’t add markup where markup is not needed. Don’t over complicate an application structure. If you have the choice between 2 or 3 paths to the same end - choose one and let it be the simplest and shortest, but with the caveat, don’t cut corners. This will make for cleaner, understandable code with faster download times, something all developers should work towards. CSS has helped this concept immersurably by removing the need to use inline styles, font tags, tables for positioning etc.

In terms of ColdFusion, the use of design patterns (e.g. Singleton, Model-View-Controller…) and the now numerous frameworks (e.g. Fusebox, Model-Glue, Mach-II, Reactor…) has reduced or even removed the concept of “spaghetti code”, the bane of may a web developer’s life and indeed the often muted argument against ColdFusion as an enterprise level application development environment.