I'm having a problem my php script witch you can see here:
http://codepad.org/F0qhElRC
Is not opening a new resource for each connection from a child.
Already I tryed using 127.0.0.1 or my local network IP but nothing worked,
also max_user_connections in mysql is set to 0 opening a connection from web gives me a different
resource for the web. But in the command line it uses the same.
In mysql_connect I specified new_link to be true, I placed a __destruct in the bd class
to close the connection if the child get's destroyed. Closing the connection does not make
php open a new one even after I restart the script. The resource could be free and so I should
count on that but in the childs I also have tryed placing a sleep but that doesn't make it run
a new resource.
Any sugestions on how to debug this?
Basically I whant a new conn for every new script or child call.
Thanks in advance.
Best regards,
解决方案
You've managed to omit all the relevant code, but many database extensions in PHP reuse currently open connections unless you specifically instruct them not to do so. If you are using mysql_connect(), have a look at the $new_link parameter:
mysql_connect — Open a connection to a MySQL Server
Report a bug
Description
resource mysql_connect ([ string $server = ini_get("mysql.default_host") [, string $username = ini_get("mysql.default_user") [, string $password = ini_get("mysql.default_password") [, bool $new_link = false [, int $client_flags = 0 ]]]]] )
Opens or reuses a connection to a MySQL server.
.
new_link
If a second call is made to mysql_connect() with the same
arguments, no new link will be
established, but instead, the link
identifier of the already opened link
will be returned. The new_link
parameter modifies this behavior and
makes mysql_connect() always open a
new link, even if mysql_connect() was
called before with the same
parameters. In SQL safe mode, this
parameter is ignored.