-1

Well I was wondering how PHP handles MySQL connection?

For example, on our web-server there are index.php, info.php. Each one of them has to connect to a database and retrieve some data. That means that on both of those files I got to make mysqli_connect or could I have a "global" connection? For every client, that visit my website, PHP create new connection?

So one case scenario might be on index.php there is a select query and at same time there are 10000 visitors on my website. so there will be created 10000 connections?

Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
Argiris
  • 189
  • 2
  • 15

1 Answers1

0

PDO allows you to create pool of connections to avoid the overhead of establishing a new connection every time a script needs to talk to a database. Please check for more detail: http://php.net/manual/en/pdo.connections.php

samarkand
  • 47
  • 1
  • 9