Open Source Software - My Grapplings with MySQL, PHP and WordPress
Open Source and Microsoft - never the twain
For most of my professional life in software development (say, the last two thirds of it) I have been in the Microsoft camp. I started out using Solaris/Unix, Vi, LaTeX and shell script, and I awked, grepped and sedded merrily away. But nowadays I am used to VB, ASP, VBScript, Access and Microsoft SQL Server. For web applications, the world tends to split into two camps - the Open Source LAMP Stack Gang (Linux + Apache + MySQL + PHP), who use free gear, and the Microsoft Bunch (Windows + IIS + SQL Server + ASP.NET), who have historically paid considerably more than nothing for their software development tools.
I understand that the LAMP Stack Gang far outnumber the Microsoft Bunch, and a major reason for this must be cost. You can get all the pieces of the LAMP Stack for free, which is great if you are are a solo developer or small outfit with little spare cash to capitalise your software projects. Isn't it the case that the vast, vast, huge majority of web servers in the world are Apache systems, almost certainly run on some version of Unix? I think so, although it may be that the split of 98% to 2% split has moved somewhat in the direction of the IIS/Windows combination in recent years.
The twain rarely meet. It's cool to be a Microsoft Hater. Dude. Let's face it, it is quite easy to find yourself cursing Microsoft when stuff does not work the way it should - say SQL Server Management Studio just crashes on you, or Excel does the same in the middle of some complex formula definitions, or Word just hangs forever.... I could go on, and indeed I might on another occasion. It's easy to criticise the Open Source School too, though - focussing on the myriad of versions, lack of coherent documentation and support.
It's a bit like the adage: "There are 10 types of people in the world: those who understand Binary and those who don't."
It's pretty entrenched.
Well, as of a few months ago, I have been programming web applications in PHP with a SQL Server backend - which I guess is a novel, mixed aproach, and it gives the lie to the "Never the Twain" motto. PHP is indeed a powerful language and I quite like it. Some of my colleagues are ace gurus with it and I have lots to learn yet.
Installing PHP was a bitch, however. Which version should I instal? What changes are there between versions? There is a decided lack of concern for backwards compatibility. What extensions should I enable. What else do I need to tweak in IIS to make it work? It is really fiddly and as a developer, I'd rather be focussing my mental energies on solving problems of design architecture, not farting around with configuration details.
My work installation has been stable for months now so I don't worry about it any more.
But this weekend, I have had cause to want to investigate WordPress in some detail. (WordPress is a great blogging engine, by the way, but that is not imporant here.) Now, WordPress is written in PHP and sits on a MySQL database. So I decided to get personal with the installation process and instal WordPress on my laptop. Yes, it's a Windows laptop - XP Professional SP3 if you want to know; and it has been a trusted development box for some years.
That's where my problems began.
MySQL
I'd installed MySQL on my laptop some months before, to see what it was like, but I had not got round to doing anything meaningful with it, so I decided to uninstal it and begin afresh with the latest download.
Watch out! MySQL does not uninstal properly. It leaves stuff behind that you have to remove by hand; otherwise it gets in a tangle when you re-instal. When I can find the online article that showed me the workaround, I'll post it. Of course I did not get this the first time round. At first I figured it was me doing something dumb, so I did the obvious thing and went through the uninstal-instal cycle another once (or was it twice?). So that turned out to be the "something dumb" that I'd been doing.
PHP
O god help me! PHP for Windows is about the most disjointed deployment I have come across. There seem to be differing distributions and options (e.g. PECL library for Windows, whatever that means) and its easy to find that the installation does not support some other PHP application because it needs this or that DLL. You can also use either CGI or ISAPI as your interpreting engine within IIS. How do you decide? There is no definitive answer, it seems, as there are strong advocates of both. Then you can find that certain DLLs need to be copied from your C:\PHP folder to your Windows or system32 folder, which means your PHP installation files are spread around the box, which is not so good if you need to upgrade cleanly or uninstal.
WordPress
WordPress is a great blogging engine that has come of age and can be enhanced to act like a proper CMS. It's really great. However, it is written for Unix/Linux systems, not Windows. As long as you can put PHP and MySQL on the box first, you should be okay. Installing WordPress still felt a little allien to me, possibly because I have been brainwashed by the Microsoft experience
The WordPress folks boast about their so-called "Famous 5-Minute Install". Their target installation audience is users who have hosting provided by a thrid party with the necessary environment pre-prepared, admittedly. Nevertheless, this claim was a joke for meand it took ages; I kept getting an unhelpful error message announcing that something (it did not say what) was not configured correctly for WordPress. Hours of googling got me the answer eventually: I had to move some DLLs or enable some extensions in the php.ini file. The thing is, the WordPress.org web site does not feature much information to help Windows folks doing a local instal like this. Am I such a freak?
Microsoft's Answer
I did get a WordPress installation working on my laptop, and it was a good learning experience. What I found out very soon afterwards is that Microsoft have themselves taken on the challenge to make available smooth installations on Windows servers (and XP boxes). They have a thing called the Web Platform Installer (WPI), which claims to do it all for you, and not just WordPress:-
www.microsoft.com/web
Microsoft have realised just how popular a number of online tools have become, with many hosting providers offering one-click instals. Some of them do not use any Microsoft technology to work and are free - such as WordPress and Joomla - and I guess Microsoft want a piece of this action.
They have gathered a bunch of platforms and apps together and made them available through the WPI. This clever application instals on your Windows machine and then you can use it to select your favourite web app (say WordPress). The WPI figures out the dependencies (in this example, MySQL and PHP), then it fetches them for you and and instals them. Then it instals the app that you chose. You are guided through this process by a wizard that asks you for passwords and so on.
I have to sing qualified praises for Microsoft here - praise because the thing actually works, or at least it worked for me; qualified because it's not full-proof and gets stuff wrong if you have installed an app already by hand, say. Oh, and hangs sometimes for no excusable reason. I have found out that the WPI has been around for some months now, so in my view these glitches are very poor show by Microsoft. The WPI also appears not to include an uninstal feature for the items installed using it, which seems to be half-heated to me.
In my case I tried to use it to use the WPI instal WordPress again on my laptop - this time the "Microsoft Way". I had to totally uninstal my instance of PHP as it used ISAPI and the WPI wants to use FastCGI and it got all confused. Uninstaling PHP was tricky - again, I had lots of help from Google to delete the right files and remove objects from IIS. And I uninstalled MySQL too (remember that that is not straightforward either). This way I ensured that I gave Microsoft the power to choose exactly which version and build of each item to fetch and instal.
Eventually it all came together. It is impressive to watch the WPI working through the process and it is relaxing also not to have to instal all the dependencies myself, although I'll remind you that I did go through the exercise first, just to prove my chops.
So in the end I used a Microsoft solution to instal Open Source, non-Microsoft applications on my Windows machine. In the UK we now have a coalition government made up of Conservatives and Liberals, which is a historic pairing of political rivals. And we also have this blurring of the distinction between two software worlds that once divided the web development community.
It is a brave new world.
For most of my professional life in software development (say, the last two thirds of it) I have been in the Microsoft camp. I started out using Solaris/Unix, Vi, LaTeX and shell script, and I awked, grepped and sedded merrily away. But nowadays I am used to VB, ASP, VBScript, Access and Microsoft SQL Server. For web applications, the world tends to split into two camps - the Open Source LAMP Stack Gang (Linux + Apache + MySQL + PHP), who use free gear, and the Microsoft Bunch (Windows + IIS + SQL Server + ASP.NET), who have historically paid considerably more than nothing for their software development tools.
I understand that the LAMP Stack Gang far outnumber the Microsoft Bunch, and a major reason for this must be cost. You can get all the pieces of the LAMP Stack for free, which is great if you are are a solo developer or small outfit with little spare cash to capitalise your software projects. Isn't it the case that the vast, vast, huge majority of web servers in the world are Apache systems, almost certainly run on some version of Unix? I think so, although it may be that the split of 98% to 2% split has moved somewhat in the direction of the IIS/Windows combination in recent years.
The twain rarely meet. It's cool to be a Microsoft Hater. Dude. Let's face it, it is quite easy to find yourself cursing Microsoft when stuff does not work the way it should - say SQL Server Management Studio just crashes on you, or Excel does the same in the middle of some complex formula definitions, or Word just hangs forever.... I could go on, and indeed I might on another occasion. It's easy to criticise the Open Source School too, though - focussing on the myriad of versions, lack of coherent documentation and support.
It's a bit like the adage: "There are 10 types of people in the world: those who understand Binary and those who don't."
It's pretty entrenched.
Well, as of a few months ago, I have been programming web applications in PHP with a SQL Server backend - which I guess is a novel, mixed aproach, and it gives the lie to the "Never the Twain" motto. PHP is indeed a powerful language and I quite like it. Some of my colleagues are ace gurus with it and I have lots to learn yet.
Installing PHP was a bitch, however. Which version should I instal? What changes are there between versions? There is a decided lack of concern for backwards compatibility. What extensions should I enable. What else do I need to tweak in IIS to make it work? It is really fiddly and as a developer, I'd rather be focussing my mental energies on solving problems of design architecture, not farting around with configuration details.
My work installation has been stable for months now so I don't worry about it any more.
But this weekend, I have had cause to want to investigate WordPress in some detail. (WordPress is a great blogging engine, by the way, but that is not imporant here.) Now, WordPress is written in PHP and sits on a MySQL database. So I decided to get personal with the installation process and instal WordPress on my laptop. Yes, it's a Windows laptop - XP Professional SP3 if you want to know; and it has been a trusted development box for some years.
That's where my problems began.
MySQL
I'd installed MySQL on my laptop some months before, to see what it was like, but I had not got round to doing anything meaningful with it, so I decided to uninstal it and begin afresh with the latest download.
Watch out! MySQL does not uninstal properly. It leaves stuff behind that you have to remove by hand; otherwise it gets in a tangle when you re-instal. When I can find the online article that showed me the workaround, I'll post it. Of course I did not get this the first time round. At first I figured it was me doing something dumb, so I did the obvious thing and went through the uninstal-instal cycle another once (or was it twice?). So that turned out to be the "something dumb" that I'd been doing.
PHP
O god help me! PHP for Windows is about the most disjointed deployment I have come across. There seem to be differing distributions and options (e.g. PECL library for Windows, whatever that means) and its easy to find that the installation does not support some other PHP application because it needs this or that DLL. You can also use either CGI or ISAPI as your interpreting engine within IIS. How do you decide? There is no definitive answer, it seems, as there are strong advocates of both. Then you can find that certain DLLs need to be copied from your C:\PHP folder to your Windows or system32 folder, which means your PHP installation files are spread around the box, which is not so good if you need to upgrade cleanly or uninstal.
WordPress
WordPress is a great blogging engine that has come of age and can be enhanced to act like a proper CMS. It's really great. However, it is written for Unix/Linux systems, not Windows. As long as you can put PHP and MySQL on the box first, you should be okay. Installing WordPress still felt a little allien to me, possibly because I have been brainwashed by the Microsoft experience
The WordPress folks boast about their so-called "Famous 5-Minute Install". Their target installation audience is users who have hosting provided by a thrid party with the necessary environment pre-prepared, admittedly. Nevertheless, this claim was a joke for meand it took ages; I kept getting an unhelpful error message announcing that something (it did not say what) was not configured correctly for WordPress. Hours of googling got me the answer eventually: I had to move some DLLs or enable some extensions in the php.ini file. The thing is, the WordPress.org web site does not feature much information to help Windows folks doing a local instal like this. Am I such a freak?
Microsoft's Answer
I did get a WordPress installation working on my laptop, and it was a good learning experience. What I found out very soon afterwards is that Microsoft have themselves taken on the challenge to make available smooth installations on Windows servers (and XP boxes). They have a thing called the Web Platform Installer (WPI), which claims to do it all for you, and not just WordPress:-
www.microsoft.com/web
Microsoft have realised just how popular a number of online tools have become, with many hosting providers offering one-click instals. Some of them do not use any Microsoft technology to work and are free - such as WordPress and Joomla - and I guess Microsoft want a piece of this action.
They have gathered a bunch of platforms and apps together and made them available through the WPI. This clever application instals on your Windows machine and then you can use it to select your favourite web app (say WordPress). The WPI figures out the dependencies (in this example, MySQL and PHP), then it fetches them for you and and instals them. Then it instals the app that you chose. You are guided through this process by a wizard that asks you for passwords and so on.
I have to sing qualified praises for Microsoft here - praise because the thing actually works, or at least it worked for me; qualified because it's not full-proof and gets stuff wrong if you have installed an app already by hand, say. Oh, and hangs sometimes for no excusable reason. I have found out that the WPI has been around for some months now, so in my view these glitches are very poor show by Microsoft. The WPI also appears not to include an uninstal feature for the items installed using it, which seems to be half-heated to me.
In my case I tried to use it to use the WPI instal WordPress again on my laptop - this time the "Microsoft Way". I had to totally uninstal my instance of PHP as it used ISAPI and the WPI wants to use FastCGI and it got all confused. Uninstaling PHP was tricky - again, I had lots of help from Google to delete the right files and remove objects from IIS. And I uninstalled MySQL too (remember that that is not straightforward either). This way I ensured that I gave Microsoft the power to choose exactly which version and build of each item to fetch and instal.
Eventually it all came together. It is impressive to watch the WPI working through the process and it is relaxing also not to have to instal all the dependencies myself, although I'll remind you that I did go through the exercise first, just to prove my chops.
So in the end I used a Microsoft solution to instal Open Source, non-Microsoft applications on my Windows machine. In the UK we now have a coalition government made up of Conservatives and Liberals, which is a historic pairing of political rivals. And we also have this blurring of the distinction between two software worlds that once divided the web development community.
It is a brave new world.