Your problem is most likely that you're installing php from an rpm, so it is being pointed to the incorrect location for mysql.
To get php working correctly you'll need to download the source from php.net , and run ./configure with some options such as (se ./configure --help for all of them)
Those are off of the top of my head, so I'm not positive that they're correct, so you may want to check before using them. apxs is an apache binary used to compile modules. Gd and Freetype are necessary to use php functions involving images. You may want to configure it with other options too, just make sure you read ./configure --help.