I think i have a problem with Phalcon framework
I have this class :
<?php
class Testmysql extends \Phalcon\Db\Adapter\Pdo\Mysql {
static $id = null;
/**
* Creates the Adapter
*/
public function __construct(array $descriptor = NULL)
{
self::$id = uniqid(true);
error_log(self::$id."\tMySQL::__construct()\n", 3, '/usr/share/nginx/html/test.log');
return parent::__construct($descriptor);
}
/**
* Connect
*/
public function connect(array $descriptor = NULL)
{
error_log("MySQL::connect()\n", 3, '/usr/share/nginx/html/test.log');
return parent::connect($descriptor);
}
/**
* Close
*/
public function close()
{
error_log(self::$id."\tMySQL::close()\n", 3, '/usr/share/nginx/html/test.log');
return parent::close();
}
}
and this test script :
<?php
require '../../public/_bootStrap.php';
$mysql_host = "localhost";
$mysql_user = "root";
$mysql_pass = "";
while(true) {
$db = new Testmysql(["host" => $mysql_host,
"username" => $mysql_user,
"password" => $mysql_pass,
"dbname" => "db_test",
"persistent" => true,
"options" => [],
]);
echo ".";
if($i++ >= 100) {
break;
}
}
In my log i have 200 lines :
157cfe92d7447e MySQL::__construct()
MySQL::connect()
157cfe92d744e6 MySQL::__construct()
MySQL::connect()
So first problem : i don't have any close connection Secondly : I set persistent connection but i have different connection each time !
So ? What do you think ?