301 redirect with PHP

When you change the URL/URI of a page, a permanent redirection should be set up from the old address to the new address to let user-agents know where it can now be found. When using a web browser the redirection is usually seamless; for search engine bots they will now know to stop requesting the old page and instead request the new address in the future. This post looks at how to do this with PHP.

Categories PHP

Install PHP PECL on CentOS

When trying to install the PECL timezonedb module onto one of my webservers the other day, I discovered that the PECL library was not installed. (PECL is a repository for PHP extensions). I did a Google search for how to install PECL but couldn’t find anything to help. In the end I managed to work out that by installing PEAR, PECL is installed as well.

How to tell if it’s a leap year with PHP

PHP contains a useful date function which can be used to determine if the current year or a specific year is a leap year. This post looks at how to use the date function to do this.

Categories PHP

Set the default font size for phpMyAdmin

phpMyAdmin is a web based administrative tool for the MySQL database server. After logging in to phpMyAdmin there’s a drop down box to select the font size as a percentage which always defaults to 100% and is too big for my liking. After changing the value, the font size is remembered as a cookie so the next time you log in the font size chosen is remembered. However the font size cookie drops off eventually and when logging into a phpMyAdmin that I haven’t logged into for a while I find it annoying having to change the font size each time. This post looks at how to change the default phpMyAdmin font size.

Categories PHP

Get message body and attachments using PHP IMAP

The last post looked at how to get a message structure using the PHP IMAP functions into an easier to use flat array. This post looks at how to loop through that array to easily get all the message parts and attachments.

Categories PHP