Articles

A collection of articles and snippets I've collected over the years.


Forcing a file to download using the Silex PHP framework

January 2, 2013

I've just been searching for a way to force a file to download using the Silex PHP framework and didn't find any examples. After reading through the Silex code I worked it out. Here's how to force a...

Install PHP and Mysql on OSX Mountain Lion

December 19, 2012

I usually develop on an Ubuntu VM running in VirtualBox but have needed to install PHP and MySQL on OSX Mountain Lion on the MacBook Pro. Here's a Github Gist from Aaron Brady with details on how to...

How to highlight keywords when using tail

October 16, 2012

Have you ever been tailing a log file looking for a specific keyword or phrase? Maybe you're tailing an Exim log watching for an email, or an Apache log file for a specific request. Wouldn't it be...

Restart Apache on Mac OS X Mountain Lion

October 15, 2012

This is here for reference as I keep forgetting how to restart apache on Mac OS X Mouintain Lion. Here's how to do it: Enter password and you're done. You can also start and stop Apache by using...

Change the cursor with JQuery

September 24, 2012

Occasionally I use JQueryUI components to display dialogs and I like to set the cursor to the 'timer' when the event is triggered and back to 'auto' afterwards. Here's how to change the cursor with...

Detect iPad and iPhone with PHP

July 25, 2012

If you ever have the need to detect iPad and iPhone with PHP, or any other mobile/tablet device, you can use the excellent php-mobile-detect library available at...

How to find the Magento version

July 11, 2012

Often you will need to know which version of Magento you are running in order to install an extension or apply a security patch. Heres how to find the Magento version you are running....

Gzip javascript and css with NGinx

June 29, 2012

Nginx by default will only compress text/html content types. Heres how to gzip javascript and css with NGinx: In your nginx.conf file: Or in your sites-enabled site file: Reload nginx and your...

Sending HTML Mail via SMTP with PHP Pear Mail

May 30, 2012

Here's how to send html email via remote SMTP using PHP and Pear Mail / Mime. To install the classes you should enter (as a superuser): The following code shows how to send an HTML mail...

How to add APC cache to Magento

May 10, 2012

The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. It can help speed up your Magento installations. First, install the PHP APC package (Assuming you are using Ubuntu as your...

Speed testing your website with Siege: Part two

March 29, 2012

If you need to test more than one URL then you will need to tell Siege to use a file to load the URLs from. Simply create a text file called urls.txt and add each URL you want to test on a...

Speed testing your website performance with Siege: Part One

March 28, 2012

Your website performance is crucial to your business and you need tools to measure the response times and number of requests your website can handle. Siege is perfect for this. A tool to test and...

WordPress auto update ‘Unable to locate WordPress Content directory’ or ‘Could not copy file’ fix

February 4, 2012

WordPress is a great way to get a website up and running quickly and the sheer number of plugins and themes means that you can do a lot with it. The downside to this is that both Worpress core and...

My “Must Have” utilities on Ubuntu

November 4, 2011

My OS of choice is Ubuntu and there are a few "Must Have" utilities on Ubuntu I usually install straight away. Here's a list of the ones I use the most. From left to right these are:...

Test SMTP with a dummy server in Python

October 13, 2011

Here's how to test SMTP with a dummy server in python

Viewing the PHP APC cache in Ubuntu 10.10

October 11, 2011

APC is a great tool for caching in PHP and once installed it is very easy to use. However, what do you do about viewing the PHP APC cache in Ubuntu? Well, there is a fantastic PHP page provided by...