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).
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?! ;)
I'm sure most of you are aware of this but it's something that always takes me a long time to remember.
Whenever you have a seemingly random error on your Linux box - strange MySQL or Apache errors, being unable to write to a file that you could write to a moment ago, etc - always do a quick df -h to check how much disk space you've got left.
This problem is especially evident for those of us developing on virtual machines that often have limited disk space and so can run out easily. A quick recce of your /var/log/ (or equivalent) directory is a good starting point for freeing up space but you may also want to try find / -type f -size +50000k