Running PHP mail() in Your Local PC

Posted on Updated on

Email testing has been a headache for most developers. You need to upload your script every now and then just to check if your script is working. A tedious work especially when you got a bunch of email script to work on. It would have been very nice if you could do it locally in your pc.

XAMPP provided an email server to PHP developers that would help ease our suffering. Mercury is a pre-installed mail server in the XAMPP that only a few knows how to use. I am one of the many that don’t until recently, I needed to test a lot of email scripts and frequent uploading is oftentimes vexing.

I have found a good thread that helped me in setting up the mail server in my computer.

In this tutorial, we will be needing XAMPP bundle (I am using version 1.7.0) and Thunderbird as our email manager. I will be assuming that you have successfully installed both softwares in your computer.

Running Mercury and Apache Server

Open your XAMPP Control Panel(CP) (Start > Apache Friends >XAMPP Control Panel) and make sure that Mercury mail and Apache is running. If not simply click the ‘Start’ button beside them.

XAMPP Control Panel Application

Email Accounts

In the XAMPP CP, open the Admin area of Mercury by clicking the corresponding admin button. Warning: Do not close any of the window inside the admin area.


In the admin area, go to Configuration > Manage Local User. In here, we could set the admin password and create new user.


To add admin password, select admin then hit ‘Change’. Fill-up ‘Mail Password’ then ‘Ok’.
To add new user, click ‘Add’ then enter username and password for the user.

Remember: the username is used as the email address. Example: Username=admin, Email=admin@localhost

Here, I created useraccount ‘jane’, so her email will be ‘jane@localhost’. We use ‘localhost’ because we are running  our mail server in our localhost.

Default ‘From’ Email address

To set our default email address, open file ‘XAMPP\apache\bin\php.ini’. Warning: If you are not familiar with php.ini file, it is best that you a save copy of the file before commiting any changes to it.

Search for ‘;sendmail_from’ and change this line to ‘sendmail_from = admin@localhost’ then save. We must now restart our Apache server.

Configuring Thunderbird

After setting up our mail server, let us now configure our Thunderbird so that we could read the emails that we would be sending in our localhost.

Open up the Thunderbird browser. Go to Tools > Account Settings. In the new window, Click ‘Add Account’ then follow the steps from the images below. Create an account for admin@localhost and jane@localhost (or whichever user account you created).







Testing Email Script

In your ‘XAMPP\htdocs’ create a folder named test. Inside ‘test’ folder, create an email script similar to the one below then save it as ’emailtest.php’. Run your script in your browser. ‘http://localhost/test/emailtest.php’. The output should be ‘bool(true)’.


Open your Thunderbird browser then click ‘Get Mail’. Enter the corresponding passwords once the prompt box appear.

The output should be similar to the one below


And there you go. You can now run your email script in your local pc.



Chillin’ Out at Starbucks

Posted on Updated on

We are currently hanging out at Starbucks Trinoma. Me, meo and little bro are spending our Sunday to enjoy. Later, we will go to church after hanging out.

The whole week have been boring and frustrating and there is no other thing we need but to relax.

Starbucks Moments

It is a really cool feeling to flaunt your laffy taffy at the middle of the crowd and look at their faces caught in awe.  hehe I am not that mean don’t worry.

Tomorrow would be a very special day for me. Besides Chinese New Year and Annular Solar eclipse, I would start my review for ZCE. I will be self-studying because the online review is expensive.

I will enjoy this day to the fullest because tomorrow, I will be heading to a tedious path of work and studies.

^_^ Good luck to me.

PHP Regular Expression Tutorial

Posted on

Here is a very comprehensible tutorial of regular expression from It has a very good discussion and simple examples that is easy to understand.

Regular Expression Tutorial

PHP Latest: PHP 5.2.8 Released!

Posted on Updated on

Just got from

PHP 5.2.8 Released!

The PHP development team would like to announce the immediate availability of PHP 5.2.8. This release addresses a regression introduced by 5.2.7 inregard to the magic_quotes functionality, that was broken by an incorrect fix to the filter extension. All users who have upgraded to 5.2.7 are encouraged to upgrade to this release, alternatively you can apply a work-around for the bug by changing “filter.default_flags=0” in php.ini.

PHP 5.2.7 has been removed from distribution

Due to a security bug found in the PHP 5.2.7 release, it has been removed from distribution. The bug affects configurations where magic_quotes_gpc is enabled, because it remains off even when set to on. In the meantime, use PHP 5.2.6 until PHP 5.2.8 is later released.


Zend PHP 5 Certification Exam Coverage

Posted on Updated on

If you are planning to take Zend’s PHP 5 Certification, here is a quick list of the exam’s coverage:

PHP Basics

  • Syntax
  • Operators
  • Variables
  • Constants
  • Control Structures
  • Language Constructs and Functions


  • Syntax
  • Arguments
  • Variables
  • References
  • Returns
  • Variable Scope


  • Enumerated Arrays
  • Associative Arrays
  • Array Iteration
  • Multi-Dimensional Arrays
  • Array Functions
  • SPL

Object Oriented Programming

  • Instantiation
  • Modifiers/Inheritance
  • Interfaces
  • Exceptions
  • Static Methods & Properties
  • Autoload
  • Reflection
  • Type Hinting
  • Class Constants


  • Configuration
  • Session Security
  • Cross-Site Scripting
  • Cross-Site Request Forgeries
  • SQL Injection
  • Remote Code Injection
  • Email Injection
  • Filter Input
  • Escape Output

XML and Web Services

  • XML Basics
  • SimpleXML
  • XML Extension
  • Xpath
  • Webservices Basics
  • SOAP
  • REST

Strings and Patterns

  • Quoting
  • Matching
  • Extracting
  • Searching
  • Replacing
  • Formatting
  • PCRE

Databases and SQL

  • SQL
  • Joins
  • Analyzing Queries
  • Prepared Statements
  • Transactions

Web Features

  • Sessions
  • Forms
  • GET and POST data
  • Cookies
  • HTTP Headers

Streams and Network Programming

  • Files
  • Reading
  • Writing
  • File System Functions
  • Streams


PHP Release History

Posted on Updated on

PHP is a computer language used to create dynamic web pages.

What makes it great? It’s platform independent, easy to use and best of all it’s FREE. It runs under PHP Licence.

What is PHP Licence? The PHP License is the software license under which the PHP programming language is released. The PHP License is a GPL incompatible free software license according to the Free Software Foundation and the Open Source Initiative.

The current stable version of PHP is 5.2.6. Here is the release history of PHP:

Major Version Minor Version Release date Notes
1.0 1.0.0 1995-06-08 Officially called “Personal Home Page Tools (PHP Tools)”. This is the first use of the name “PHP”.
2.0 2.0.0 1996-04-16 Considered by its creator as the “fastest and simplest tool” for creating dynamic web pages
3.0 3.0.0 1998-06-06 Development moves from one person to multiple developers. Zeev Suraski and Andi Gutmans rewrite the base for this version.
4.0 4.0.0 2000-05-22 Added more advanced two-stage parse/execute tag-parsing system called the Zend engine.
4.1.0 2001-12-10 Introduced ‘superglobals’ ($_GET, $_POST, $_SESSION, etc.
4.2.0 2002-04-22 Disabled register_globals by default. Data received over the network is not inserted directly into the global namespace anymore, closing possible security holes in applications.
4.3.0 2002-12-27 Introduced the CLI, in addition to the CGI.
4.4.0 2005-07-11 Added man pages for phpize and php-config scripts
4.4.8 2005-07-11 Several security enhancements and bug fixes. End of life release for PHP 4
5.0 5.0.0 2004-07-13 Zend Engine II with a new object model.
5.1.0 2005-11-24 Performance improvements with introduction of compiler variables in re-engineered PHP Engine.
5.2.0 2006-11-02 Enabled the filter extension by default.
5.2.6 2008-05-01 Several security enhancements and bug fixes
5.3.0 No date set
6.0 6.0.0 No date set
Colour Meaning
Red Old release; not supported
Yellow Old release; still supported
Green Current release
Blue Future release

Cruizin 101: Test Driven Development (TDD) for the Masses

Posted on Updated on

The PHP User Group of the Philippines (PHPUGPH) held a seminar about Test-Driven Development last March 15, 2008 at dotPH Domains Inc in Jollibee Plaza, Ortigas.

Here is an excerpt from our forum about the speaker.

Andre John Cruz aka cruizer is a Microsoft MVP for Visual C# and an Administrator for His day job is an Application Developer for Barclays Capital Singapore. He is an avid FOSS enthusiast, and also an active participant in various user communities in the Philippines, both Microsoft and non-Microsoft oriented. He is known as a proponent of the test-driven development (TDD) practice in the .NET world and has spoken a few times about the topic in recent Philippine MSDN events.

He was very humble and very open. He answers every questions laid in front of him. If there are things that he doesn’t know or has a doubt, he will tell you about it and try to suggest related sites or ideas about them.

For any inquiries, there is a free CD for the who asked the question. I am sad that I did not have the guts to asked. 😦 *sigh

It was the first seminar that I have attended after student days. Most of the attendees are IT Professionals like me. The officers are friendly and fun to be with. And they value time much. The event started exactly at 2:30 PM and the break time was followed accordingly.

The venue is great. It has a very workable and comfortable atmosphere suitable for the event. And even if you don’t have a microphone, your voice can be heard all over the room.

The discussion included:

  • What is TDD and the pros / cons of using it
  • How to use SimpleTest in TDD
  • Examples of basic and intermediate TDD coding
  • Practical Way of Writing your OOP
  • Unit testing

The seminar was a success for me. I believe that Sir Andre has imparted a very important coding technique which is very practical and manageable, TDD that is. Despite his hectic schedule while in the Philippines, he manages to speak for this remarkable event.

At the end of the discussion, prizes were given to the attendees. The most adorable one is the T-shirt from sir AJ. I love that shirt. 😦

Congratulations to all who have made the event happened. To the officers of PHPUGPH, dotPH Domains where the event was held, to the people who has lended their hands and to the participants of the events.


PHPDesigner 2008: A Software Review

Posted on Updated on

internet surfing is one of my hobbies that i am most talented with. i love exploring the net and stumbling on new web pages every now then. besides discovering sites, i love downloading and trying out softwares. and because of my profession, i oftentimes search for text editors that might be very useful to me.

one of my favorite is the PHP Designer. the first version of it that i’ve tried was PHP Designer 2007 and used it for 30 days and loved the experience of coding with it.

then until recently, from our forum at, i just got the news that phpdesigner 2008 was released so i head on to to look for the available trial version. i got a copy from, downloaded and tested it of course.

PHPDesigner 2008

after minutes of exploration, here are the things i could say i like from this software:
1. on new file, it automatically adds the opening and closing php tags together with a file information comment
2. highlights the line of error, place a red mark on the line number and on highlight to the error line, it shows a tooltip of the error description.
3. shows a tooltip description of built-in function
4. auto-complete function
5. codefolding tree includes the classes, functions variables and contants, and the total number of occurences for each values.


6. xdebug is already built-in
7. has smarty variables ready
8. FTP connection can be set up fast and easy just go to Tools->FTP
9. profiler ready
10. the navigation toolbar was very organized according to ussability

guess there are still lots that i am going to like about PHP Designer 2008. i could say that my 14-days software trial is worth it. i’ll just continue my exploration next time. hope i’ve imparted good information to you. bye for now ^_^

Cheat Sheets

Posted on Updated on

here are helpful cheat sheets i got from the net. ill try to look for the links where i got them to give some credits.

  1. Regular Expression
  2. PHP
  3. Javascript
  4. CSS
  5. CakePHP