Fun with SQLite + PHP

  2005-08-23


My poor little OpenIT development box which runs on a whopping 48 MB of RAM has been running unusually slow, and I think its due to upgrading from MySQL 4.0 to 4.1. That’s really the only thing thats changed on it, and MySQL is definitely gobbling up more than its fair share of memory.

So I thought I’d give SQLite a try. pear install sqlite resulted in phpize failed, so I did what any true Slackware user would do: compile it from scratch. After the usual configure, make, make install, all I had to do was add extension=sqlite.so to my php.ini to finish setting up SQLite in PHP.

Next up: setting up OpenIT to use SQLite. Luckily the PEAR DB documentation provided an example DSN for SQLite databases. However, that caused an error when PHP tried to parse the settings.ini file. Come to find out, parse_ini_file() needs non-alphanumeric values to be double quoted! tools/setup.php failed when trying to setup the first (Campuses) table.

Long story short I created a custom PHP script and SQL script to build a SQLite database. I can now login to OpenIT, but inserts give me an unknown database error. I may keep trying to get it work because OpenIT appears to run much much faster using SQLite on this ancient computer.