Tuesday, January 13, 2009

Prado framework: problems running demo applications

PRADO is a component-based and event-driven programming framework for developing web applications in PHP5. Beginners wanting to learn Prado may have problems when they want to run demo applications on their own server. Some demos simply don't work. Particular, I had problems on xampp 1.7 for Windows with AJAX Chat, address-book and northwind-db demos. The problem is that they use sqlite3 database and they require pdo_sqlite and php_pdo_sqlite PHP extensions. However, the PHP in xampp 1.7 for Windows(PHP 5.2.8) a comes with these extensions for only sqlite2, not sqlite3!. For that reason when I tried to run e.g. AJAX Chat demo I got the "DbConnection failed to establish DB connection: could not find drive" error:
The solution to this problem was, at least for me, to convert sqlite3 databases of these demos to sqlite2.

AJAX Chat demo

The online example of this demo is here. As previously indicated, when I wanted to use the demo I was greeted with DbConnection error. This indicates that there is some problem with database connections. AJAX Chat demo requires pdo_sqlite extensions. So first thing that I did was to check if my PHP has such extensions. Before proceeding I made sure that these extensions were enabled in php.ini or php5.ini. To check if I have these extensions I used <?PHP phpinfo();?>. These resulted, among other things, with the following:This cleary shows that my pdo_sqlite driver is sqlite2. For that reason I converted the chat.db database of the AJAX Chat demo from sqlite3 to sqlite2 as follows:sqlite3 chat.db .dump | sqlite chat2.dbNext, in application.xml I made the following change from to
Following these changes the AJAX Chat demo finally worked:

Address-book demo

Online demo is here. The problem with this demo was the same as with the AJAX Chat demo, i.e. sqlite database. Since the demo uses Flex the error message was little different:To make it work, I converted the demo's sqlite3 database to sqlite2 database as follows:sqlite3 sqlite.db .dump | sqlite sqlite2.db. Next application.xml was modified as before and the demo worked:

northwind-db demo

The problem with this demo is the same as before. However, this time converting sqlite3 database to sqlite2 database resulted in errors. In another worlds, I could not convert the demo's database. The reason was that the demo's database is much more complicated than that of address-book and chat demos, and sqlite2 returned syntex errors when dumping. At the moment I'm still analyzing AJAX Chat demo, so northwind-db demo is far ahead. When and if I get to it, I try to find some solution this problem.

Download of chat2.db and sqlite2.db

The two sqlite database created are here.