Lighting the LAMP with Linux
As an all-round web enthusiast I am slightly ashamed to admit that it was only today that I learnt what the LAMP in onlamp.com signified. I knew ON was the O'Reilly Network but had never bothered to notice that LAMP stood for Linux Apache MySQL PHP/Perl/Python - The Open Source Web Platform. Shame on me!
Anyway, they've got an article published this week about Linux Annoyances. In it they talk about "RPM hell", something I've been introduced to recently. Funnily enough it was while getting my very own LAMP box setup. Unbeknown to me was that if you choose to install MySQL and PHP as part of a Red Hat setup it doesn't automatically intall support to link the two. Stange but true. My first attempt to connect PHP code to the MySQL database engien resulted in the following nastiness:
Fatal error: Call to undefined function: mysql_connect()
A little searching round and I found the answer. I needed to install the PHP-MySQL libraries from the relevant RPM. First thing I tried was to use the Red Hat Package Management GUI but this failed with no errors when I tried to add the extra package. Next step was to attempt it from the shell using the rpm command. What it told me was that I had the wrong versions and that the dependencies were all wrong. The reason for this was that, since downloading Red Hat, I had run the equivalent of Windows Update and I now had a more recent version of PHP. I was trying to install php-mysql-4.4.2-17 with php-4.4.2-17.2. Silly old me!
The solution was to search the Red Hat RPM site for the correct update. This installed fine and now everything works. You might say, the LAMP is well and truly lit. Here's a little tip I picked up along the way. Type rpm -qa | grep php
at the command line and you see a list of all packages installed with php in their name. Useful in figuring out whether an install was succcessful or not...
In a case like that you're better off doing a `grep -i php' which ignores case.
In case you do not want to subscribe to RedHat Network, you may find this interesting: {Link}