i'm using php 5.4.4 and it seems that persistent connections with mysqli don't work. In particular, let's look at this script:
<?php
$links = array();
for ($i = 0; $i < 15; $i++) {
$links[] = mysqli_connect('p:192.168.1.40', 'USER', 'PWD', 'DB', 3306);
}
sleep(15);
Then, when the script is running, open another shell and:
netstat -an | grep 192.168.1.40:3306
tcp 0 0 192.168.1.6:52441 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52454 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52445 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52443 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52446 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52449 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52452 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52442 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52450 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52448 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52440 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52447 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52444 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52451 192.168.1.40:3306 ESTABLISHED
tcp 0 0 192.168.1.6:52453 192.168.1.40:3306 ESTABLISHED
I think that this an error: PHP should open only one persistent connection instead of 15 distinct connections.
Is it true?
THANKS ALL.