Chapter 36. An Introduction to SQLite

When coding PHP, you may sometimes find that you want a database that's both easy to use and lightweight, without having the complexity of a larger RDBMS like MySQL or Oracle. Small applications, written for one-off solutions, lend themselves to these types of databases, as do applications that just need a powerful query functionality. Enter SQLite. SQLite is a lightweight database system that's bundled with PHP by default. As you'll see in this chapter, SQLite is a lightweight database system appropriate for many uses in PHP (and other languages, too).

An Introduction to SQLite

SQLite is a database engine that operates without the use of a database server. You may find yourself reading that sentence again, but it's true. SQLite has no server component, but rather directly interacts with its data through files or directly in memory. SQLite works well with small (to medium) data sets or in low-volume transactions, but because the storage medium is usually disk, accessing the data can be slower than a more robust and traditional RDBMS like MySQL.

SQLite doesn't have a privilege system in the way that MySQL does. This means that it isn't possible to limit who has access to certain databases or tables within a given database. The files holding data in SQLite are typically owned and readable by the user under which the web server is running. With these issues in mind, it's not appropriate ...

Get PHP6 and MySQL® 6 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.