SQLite

If at this point you are thinking "wow, PEAR::DB is fantastic!" then you have got another big surprise coming in the form of SQLite. SQLite is a fully functional relational database system that, for one reason or another, is only now making it into the limelight. The key advantage to SQLite, as opposed to MySQL or PostgreSQL, and indeed the reason why it is being covered here is because it does not use the traditional client/server database architecture.

MySQL, for example, has a MySQL server running on a machine somewhere, and a client (in the form of PHP in our examples), connects to that server to perform queries. SQLite, on the other hand, works on local files, with no database server required - when you run queries using SQLite, they are translated into operations on the local files.

From PHP 5 onwards, SQLite is bundled and enabled by default, which means that everyone, everywhere will have it by default. If you are writing an application that needs a data store, you need no longer worry whether they have Oracle or Microsoft SQL Server installed, or indeed whether they have any database server installed. Prior to PHP 5, getting around this problem required developers to create their own database-like file structure using complicated, hand-written functions - those days are long gone now, thankfully, but hopefully you can see how critical SQLite is!

 

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Using SQLite >>

Previous chapter: Impeared performance?

Jump to:

 

Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.