I downloaded the php. MySQL and the apache but, I am facing a problem in which the code is being displayed and not the web page. There must be a configuration problem.
Any help would be much appreciated.

What did you do? Did you follow some sort of guide?

What OS are you using? setup differs on linux, windoze and so on. Look up "installing LAMP on <your OS>" in google and you should find complete instructions. I have to say that trying to do it on windoze is a bit of a nightmare as i recall

Assuming that PHP and Apache are working correctly (and they may not be) then this is likely caused by trying to run PHP code from a module that doesn't have a .php suffix. For this reason or because of your setup, the module isn't being processed as a php module.

If you are using windows, it may be worth installing a virtual machine to run your lamp installation in. I remember trying to get it to work in windows a few years ago when I was still using it, and as I recall, I had similar problems, and never did work out how to fix them.