LanguagesPHPPHP Database Options: More Than Just MySQL

PHP Database Options: More Than Just MySQL content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

If you ask developers to list programming languages that they know are commonly used, most will include PHP on their list. As a programming language, PHP has been around for quite a few years and doesn’t appear to be going away any time soon. In fact, the PHP programming language has been in the TIOBE top 10 since 2001 and has ranked as high as number 3.

PHP is a server-side scripting language that is primarily used for creating dynamic web pages on the Internet, but has evolved to be able to do command line scripting and client-side apps. It can be used on all the main operating systems and supports most web servers. Like many programming languages, one of the common things for developers to do is tap into data within a database.

PHP has gained a large part of its popularity from its ability to tap into a wide number of databases. As PHP is seen as free software (under the PHP License), it is not surprising that one of the most common databases to be used with it is MySQL. As an open-source database management system, My SQL is also free. While many projects that use PHP use a LAMP bundle, which includes Linux, Apache, MySQL, and PHP, it is important to note that MySQL is not the only database that can be used with PHP.

PHP not just for MySQL

PHP can be used with a number of different databases. This is possible in part because PHP has a number of database abstraction layer options. These include DBA, which is a database (Dbm-style) abstraction layer that supports databases like the Oracle Berkeley DB. There is also unified ODBC support that lets you use the ODBC API to tap into databases such as IBM DB2, Solid, and Sybase SQL Anywhere.

There is also the PHP Data Objects (PDO) extension. This extension is used with database-specific PDO drivers to provide a lightweight interface for accessing databases within PHP. Note that PDO is for connecting to multiple types of databases using the same API. It does not actually translate SQL queries.

The list is long

In addition to the abstraction layers, there are database extensions available for PHP that are vendor-specific. These include extensions for databases such as DB++, dBase, filePro, FrontBase, IBM DB2, Ingres, MongoDB, MySQL, Paradox, PostgreSQL, and many more.

The days of using PHP with just MySQL are long gone for most PHP developers. While prior to PHP 5.1 it was typical to use native drivers to connect to a database, in today’s diverse and agile world, it is more common to use abstraction and extensions such as the PDO extension. If you tap into these extensions, you’ll be able to expand your PHP applications so they can tap into a variety of databases. 

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories