Your plan to build an open source chatbot is a good one. There are several fantastic options, AIML bots such Pandorbots, Program-O or ChatScript or RiveScript, and more.
In addition to any of those open source chatbots which are definitely worth setting up and even customizing, you may want to try designing and building your own chatbot separately. PHP is a good choice. Perl is another powerful option. ASP.NET if you are on Windows.
Artificial Intelligence is a lot of fun to experiment with. Start out simple. For example, with a Finite State Machine to play Rock/Paper/Scissors: http://www.elizabot.com/FSM ... Then you are on your way, gradually training it, to become smarter and smarter.
Adding a database is a great idea, but you don’t absolutely need a database for starters, or at least not until your bot outgrows its code listing. But, if you are planning to author thousands of records in your new chatbot engine right away, then you may as well startout designing it with database connectivity. Or perhaps you may just dig SQL… Then go for it!
All this is just meant as a friendly suggestion.