Yearly Archives: 2014

Validating an email address with PHP

Steps to validate an email address:

  1. Sanitizing the email address:
    • strtolower($emailAddress);
    • filter_var($emailAddress, FILTER_SANITIZE_EMAIL); // remove bad characters from the email.
  2. Validating the email adress:
    • filter_var($emailAddress, FILTER_VALIDATE_EMAIL);

Note: For email addresses containing Internationalized Domain Names (IDN) you need to convert it to punycode before validating the email address.

Installing LAMP stack (Apache, MySql, PHP) in Ubuntu


  • The steps in this tutorial require the user to have root permission.
  • There are many different ways to achieve the same result but I found the following steps simpler than other methods.
  • This tutorial has been tested on a fresh copy of Ubuntu 14.04 on a Virtual Machine (VM)
  • To restart apache web server you can run the following command:
  • sudo /etc/init.d/apache2 restart

Continue reading Installing LAMP stack (Apache, MySql, PHP) in Ubuntu