Hi,
I've never done it before, but I think it's best to check the Apache documentation:
Apache Tutorial: Dynamic Content with CGI---------------------------------------------------------------
Documentation Apache -
Documentation PHP -
Documentation MySQL -
Wampserver install files & addons