Mysql not found by PHP

In the middle of a Drupal install on my localhost I received the following error

No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) i…

2AM and in need of a quick fix I just created an alias in the location PHP was looking for mysql.

Replacing accented character with it’s standard character in PHP

When writing a function to save audio files with a user friendly filename , as well as a regex to remove any unwanted spaces and punctuation, I needed to replace any accented characters with their standard format.

e.g If I was saving a Beyoncé album I needed the ‘é’ in her name to be replaced with an ‘e’.

The following works perfectly:

iconv("utf-8","ascii//TRANSLIT",$filename);

WordPress: curl_setopt() error when installing plugins on 1and1 host

When trying to install/activate plugins on my WordPress site after having to reset them following a host change, I received the following error

Warning: curl_setopt(): supplied argument is not a valid cURL handle resource in ….

This turned out to be an issue with my 1and1 hosting, and how they configure their servers.

To solve the problem I added the following to my .htaccess file: