13.1. The Concept of Persistent Database Connections

This section examines the concepts related to persistent database connections in PHP.

Many people think that persistent connections can be used to have one database connection during an entire session. In other words, you connect to the database when you enter an online shop and quit it when you leave the shop. This is not what persistent connections are all about. HTTP is not a connection-oriented protocol, so it is not possible to use the same database handle across more than just one screen. In addition, database handles are automatically destroyed at the end of a PHP script, so it is not possible to pass the database handle to the next screen. This is a very important point that you must ...

Get PHP and PostgreSQL: Advanced Web Programming 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.