Firstly, as a beginner it is probably unwise to try and compile something by yourself. It is difficult, time consuming and usually not worth it anyway.
Secondly, which Distribution are you using? SuSE? Fedora? Debian?
Usually your distributions has a PHP package that you can and should use. It also generally comes with mysql support.
In the off-chance that you really need to compile it yourself, get the PHP sources from www.php.net,
extract them and change into the directory where they extracted into. There you'll find the configure program.
Hope that helps,