[ Go back to normal view ]

BW2 :: the bitwise supplement :: http://www.bitwisemag.com/2

PHP, MySQL, Apache and Vista Woes
When Setting Up is the Hardest Thing To Do...

6 August 2007

by Huw Collingbourne

This is a day I’ve been putting off for the last month. I knew it was going to be traumatic – and, by heck, I was right!



Having bought a new PC a month or so ago, I have gradually been transferring my work and my applications from my old PC to the new one. Transferring word processed documents and databases is bad enough – but transferring offline interactive web sites is a whole lot worse.

I’ve mentioned before the problems I had getting the Apache web server up and running under Vista. Today I set myself the task of installing PHP, MySQL and SPIP (my favoured CMS – ‘Content management System’).

At first (and with some help from an old article of mine which explains how to set the doc_root and extension directories for PHP) the installation of PHP and MySQL seemed to go OK. But when I then installed SPIP and tried to log onto the local site (the one on my PC), I kept seeing directory listings instead of actual web pages.

After a bit of Googling I eventually found the answer to this problem. To my surprise, it turned up, once again, in an article which I had written (but which, in the intervening period, like the article I wrote on setting up PHP, I have clearly forgotten) all about installing the WordPress blog system. I’m not installing WordPress today but the principle is the same.

It turns out that you have to edit Apache’s configuration file. Find an entry similar to this...

DirectoryIndex index.html index.html.var

And add index.php so that it becomes this...

DirectoryIndex index.html index.html.var index.php

Problems, Problems...

OK, so PHP and Apache now seemed to be working smoothly together. Even so, my problems were not at an end. I discovered that MySQL wouldn’t work with PHP 5 (which I had installed) and that the files which I needed to make them work together have to be downloaded as part of the full PHP installer (not the ‘essential’ installer which I had used). I downloaded the full installer to get those files. Still, I couldn’t get it to work.

Some more Googling tuned up this site (http://www.dbforums.com/t1044828.html) where instructions were given on how and where to install the files to get everything up and running. I followed the instructions and, hey presto!, it looked as though I was in business as last. During this step, I had to edit the php.ini file, which happened to be in the \php directory under \program files. Vista allowed me to load and edit this file but (just to add a little sunshine to my day) absolutely refused to let me save my changes. This is due to its incredibly annoying User Account Control security settings. For some reason, even though I am logged on as an Administrator, Vista won’t give me Administrator privileges to let me save my modifications to php.ini (or, as far as I can figure out, any other files under \program files) without my jumping through hoops to do so.

I’ve had just about as much as I can take of those blasted User Account Controls. This was the last straw. Off they go (via Control Panel, User Accounts) and off they jolly well stay. Maybe I’m making my PC less secure but at least it should be more usable.

Ironically, I later discovered that I myself had provided similar instructions in yet another old article in which I’d explained all the steps needed to install MySQL (see the box at the bottom of that article, labelled ‘Problems...?’). There must either be something wrong with this damn’ software or something equally wrong with my memory (probably both) that I have clearly been through all these setup problem before and have subsequently forgotten how to do it. I am of the opinion that, if it’s this hard to do, it’s just too darn’ complicated!

Ah well, at least, by now my problems were all over.... well, weren’t they? The short answer is, No, they weren’t. When I now tried to install SPIP, it appeared to create a database but then bombed out with a database creation error. Examination of its log files showed that MySQL objected to SPIP trying to set default values for certain fields. Yet more Googling failed to turn up a solution,. It was sheer hackery (in the less flattering sense of the word) that eventually tracked down and fixed this. I found the MySQL configuration file my.ini and located a line that stated:

sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Purely on suspicion that this might be involved, and with scant regard for any catastrophes which such reckless action might precipitate, I commented this out:

# sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Then I restarted the MySQL service (from Control Panel->Administrative Tools->Services) and finally, much to my relief, everything seemed to be up and running.

Now let me say now that I am enormously grateful to all those people who design, develop and distribute open source software. Without the likes of Apache, MySQL, PHP and SPIP, sites such as this one would be impossibly expensive to create and run. But, oh, how I wish someone on those projects would be given the job of writing a one-click installer. This stuff is hard enough for me to get installed and running and, if I say so myself, I am not exactly a computer novice. I really can’t imagine how somebody with little or no technical knowledge would have the remotest chance of getting past the first barrier.