PHP has become one of the most popular platforms for web development today. Not only websites but enterprise applications like ERP, web based open source CRMs for SMEs and e-Commerce solutions are quiet popular today. Most of us tend to think that mySQL is the only database which connects with PHP. Others are aware that PHP supports other databases but don’t know which ones. In many cases customers are choosy about the database they would want for their implementation. This article is meant for PHP developers, web development companies and others who want to understand the databases which are supported by PHP. Please note that the information contained in this article may become outdated with time, however it would never the less be useful.
Popular Databases for PHP Web Application Development
We have tried to list down the databases as decreasing order of use cases with PHP. Therefore database which is most popular is listed on the top and the ones which are not that popular are listed further down. We would also try and maintain this article as and when new databases are added.
Here is the list below
No points for guessing this. MySQL remains most popular database for PHP applications. The database is the most popular open-source database in the world. The enterprise version of the database is available as well and is a paid one. Many popular applications like SugarCRM, Magento, WordPress and Drupal use mySQL. Big websites like Wikipedia, Facebook and Google are also its customers. MySQL workbench gives a web based user interface to manage the database.
PostGreSQL was launched in 1995 and it laid stress on compliance and standards. As compared to mySQL it is feature rich and the database is currently under its release 9.3 as compare to release 5.6 of mySQL. PostGrey has advanced optimization and compression features which put it in parallel with Oracle. Popular applications using PostGreSQL are OpenBravo and PostERP among others. However in comparison to mySQL PostGreSQL is believed to be a fraction slower.
If your uses are accustomed to Windows and you already have related infrastructure. you may want to use MS-SQL. But web development using .Net and .ASP technologies may cost you more. Therefore some customers still use PHP and get it connected to MS-SQL. However it must be noted that this works for PHP version 5+ only.
Founded in Berkley in 1984, SYBASE is now part of SAP AG. The solution is a popular choice for enterprise database management. It is also proven to perform under extreme load and is suitable where an organization needs a big database. It connects with PHP using sasql_connect() command similar to MySQL.
This came into existence in 1983 though the foundation work for this started in 1970s.This was used extensively in conjunction with mainframe systems. The database is now being used in many large scale ERP and E-Commerce implementations. For connecting it with PHP you would need PECL extension.
One of the most prevalent databases of our times, Oracle database is equally popular for Windows and Linux based servers. It is difficult to come across organizations which do not use this database. For connecting with PHP applications, OCI8 extension is needed. Once the extension is in place oci_connect function can be used to connect to the database. Function oci_close() can be used to disconnect the connection.
Other supported databases
Other databases which can be connected with PHP are listed below. Some of them are open source and others are proprietary. You can get more information about them by going their home page. This list has been arranged in alphabetic order.
- Ovrimos SQL
- Tokyo Tyrant
PHP programming ideas for handling database
Some of the most efficient PHP developers treat database as an external entity to ensure best performance for their application. The following are the best practices we suggest
- Minimize the number of selects you write in your PHP program. Try to select data in single shot and filter by using arrays.
- Make use of fields which define the keys while selecting the data.
- Joining more than 3 tables is not advisable.
- Select only the fields that you require for processing instead of using SELECT *.
- Avoid aggregate functions like SUM, AVERAGE, MAX. Use them only in case of no alternate and when database is small.
Summary of the Article
Having understood the various database options PHP provides you can take an informed decision regarding which database you may want to use in your case. We hope that the best practices mentioned above will help you in achieving performance optimized deliverables for your client.