Archive for Uncategorized

Xampp on Linux, aka Lampp

You know how sometimes you say, ‘I’ll just do this and then I’ll have a coffee and a cigarette’? And the something then goes wrong and turns into a much bigger job which takes you all day and you wind up thinking you should have just stayed in bed.

This has been such a day.

It started with a backup, or at least an attempted backup, but that’s another story. To cut it short, I ended up corrupting my whole MySQL installation, somehow, couldn’t get Lampp to work properly, un-killable instances of MySQL popping up all over the place and so on and so on.

Managed to remove everything, MySQL and Lampp (deleting all my in-development websites, because I couldn’t manage to get a backup of the databases going. Waaah!!)

Anyway, decided I needed a guide re-installing Lampp on my computer, in case I needed to do it again. So here goes. Note, this works on my machine, it might not on your, or my next machine!

  1. Download Lampp from Sourceforge. Note to Joomla devs, you can’t use the latest version, it’s PHP is too advanced (get that!!!) for Joomla. At the time of writing, version 1.6.4 is recommended. Look in File menu on the Sourceforge website for your distribution.
  2. Unzip it using this nifty little command:

tar xvfz path-to-your-download/xampp-linux-1.6.4.tar.gz -C /opt I don’t know why you have to do it like that. I think the guys at Linux just like typing a lot. Don’t be tempted to sudo this command. It just makes everything belong to the root user, and you can’t do anything until you change all the file permissions. What a ball ache.

That installs in into /opt folder. Job done! It also installs MySQL, PHP and Apache, so no need to bother putting those in separately.

Once it’s installed, start it up with sudo /opt/lampp/lampp start and point your browser at localhost/xampp and see what it says. It should say everything’s fine. If it doesn’t, you got problems. Have a look at apachfriends.org for help and friendly advice.

Next, set up security. Open a terminal and type sudo /opt/lampp/lampp security

The terminal will take you through all the steps needed to secure your installation, although if it’s just running on your local machine with no network access, you don’t really need.

Next step, you need to edit the php.ini file, especially for Joomla. Open php.ini, in /opt/lampp/etc and change the line memory_limit = 8M to memory_limit = 32M. You’ll need to open this file as root, or you won’t be able to save the changes.

Finally, if , like me, you’re running an IDE with debugging, you’ll need to enable Xdebug. This is installable from the synaptic Package manager, which remains the route of choice for me. Now you’ve installed it, you need to tell PHP to use it. Find your  xdebug.so file (on my system, it in /usr/lib/php5/20090626+lfs) Open php.ini again (as root, remember! and add the line zend_extension_ts=”/wherever/you/put/it/xdebug.so

Automatic Menus

While working on my current site I wanted to be able to add articles to a menu automatically, without having to individually add them myself. I found this great module; CatArticles

I tried both versions; for me, the 100 version worked best. You simply fill in the id of the category you want displayed, and it creates a menu of links to those articles. If you add another article to the category, then the menu is automatically updated with the new article.

CatArticle surrounds the menu with a div, so styling the menu generated is easy, and you can customise whether you want the category to be linked or not.

A very useful module, which I will certainly be using in other projects.