I had mysql already installed on my macbook and hence decided to use macports to install php5. It got apache as a dependency and installed it too. Now I couldn't get php to work with mac. Searching all around decided to save some time by just installing MAMP. Before that I need to delete everything concerning php, apache and mysql. I have removed mysql by following this:
How do you uninstall MySQL from Mac OS X?
How do I remove php5 and apache from my mac?