Installed mysql from source on linux and then how to get it work with php?

view story

http://stackoverflow.com – I installed apache and php from source and got them working together a month ago. Because I'm learning both of them this term. Now I need mysql to do more works. And I installed mysql from source just now. However I don't know how to let it work with php. I looked around and found some topics on setting up LAMP environment. Most of them install mysql first and use command options --with-mysql=/usr/local/mysql and --with-mysqli=/usr/local/mysql/bin/mysql_config when installing php. But in my case, I installed php first. Is there any way to let php know that I have installed mysql? Or should I (HowTos)