Ordering by specific field values with MySQL

There may be times when a specific order is required in a SQL query which cannot be done using either ASC or DESC or using a special sort field. MySQL has a ORDER BY FIELD function which can be used to do this.

Apache and icons directory

Default installations of Apache usually alias /icons to Apache’s icons directory which cannot be overridden in an .htaccess file. If you do not control the Apache configuration of a server, and for maximum compatibility, it is always best to never have an /icons directory at a website’s root level.

PHP’s file_get_contents and CURL functions

This is a summary of the posts I've written about PHP's file_get_contents functions when used to download remote content (e.g. webpages, XML files, images etc) and the CURL functions which are used to do the same thing.

Categories PHP

Prevent /etc/resolv.conf being overwritten on CentOS

This post is more of a reference for myself rather than anything else to solve an issue I was having with DNS lookups on a CentOS machine. It’s how to prevent the /etc/resolv.conf file being overwritten when the system restarts if you have a custom configuration you don’t want changed.

Disabling PHP short tags in an Apache .htaccess file

PHP code in a script is commonly delimited by opening <?php and closing ?> tags but there are also the older short open tags like this <? There are instances where you may need to disable short tags as shown in this post and using an Apache .htaccess file.