Tips and tricks for LAMP (Linux Apache MySQL PHP) developers.

When I cant find a suitable solution to a problem and have to work it out for myself I'll post the result here so hopefully others will find it useful. (All code is offered in good faith. It may not be the best solution, just a solution).

Sunday, 26 September 2010

Symlinks in Windows

Not strictly a LAMP tip this as it's for Windows but I found it useful recently.

I'm using the rather awesome XAMPP to do some development for one of my personal sites on my Windows machine and I wanted to symlink my codebase into XAMPP's equivalent of a 'public_html' folder (they call it 'htdocs'). I tried simply creating a shortcut but this doesn't work as a shortcut isn't a direct pointer but is a file in itself so Apache just tries to read that file.

After much Googling I discovered that, since Vista, Microsoft have introduced a symlinking function, MKLINK:

MKLINK /D C:\path\to\link C:\path\to\target

The /D specifies a link to a directory as the default is to a file.

This worked a treat on my Windows 7 machine! Who knew Vista introduced something useful?! ;)

Monday, 19 April 2010

Colour Schemes

This is more for designers than developers but some of us have to do both :)

When coming up with a colour scheme for a site or UI it's a good idea to use colours that compliment each other. This isn't just a design thing, it's partly mathematical and there are some sites out there that can calculate compatible colours for you.
This is a good example:

Another thing that can be useful is the ability to blend two colours together. allows you to input two hex colour values and it will give you the resulting hex colour value.

Friday, 9 April 2010


I've been developing a PHP-GTK application over the past few months and have found that there are very few resources out there to help (the entire project seems a bit dead tbh..), however I have come across a few invaluable things that I thought I'd share:

php-gtk2 Cookbook: This is by far the best resource I have found. It has loads of examples and you can even look them up by widget type. It also has a help forum full of useful answers.
You have to register to see all of the code but it's free and I haven't had any spam as a result so I highly recommend it.

Official API documentation: This is a bit feeble but contains all the classes and methods (even if it doesn't explain them very well).
One thing to watch out for with this is that the class pages don't show you inherited methods (even from interfaces) so you have to read through the entire hierarchy to get the full picture.

Glade UI Designer: A handy tool for constructing interfaces for GTK. These produce an XML file which you can then read into your PHP code with the GTKBuilder class. Much nicer than having to create all of your interfaces in code.
Be wary though that it is a bit flakey (crashes sometimes) and it can only do so much for you, some of it will still need to be done in code.

When looking for other resources remember that GTK isn't specific to PHP and so you may find more results for just searching for GTK stuff.

Hope that helped!