Here:
http://freshmeat.net/projects/myperl/
I need to enable PHP
in MySQL
David Sklar has made a MySQL UDF that interprets PHP code. In the last example, he runs PHP code that was stored in a database table.
See http://www.sklar.com/page/article/myphp
Disclaimer: I haven't actually tried the module.
Most of the binary php distributions (Zend, ActiveState, xamp, wamp etc. etc.) come complete with mysql enabled.
The "pdo" interface (a common interface that supports several DBs much like perl's DBI) is recommend.