如何在PHP中存储持久数据库连接?

时间:2021-07-27 03:47:59

As stated in the documentation on sqlite_popen php tries to make use of a persistent resource mechanism. Where is this mechanism described in detail? Is it possible to view all resources currently stored/used? Is it possible to access this mechanism and store/read other values?

正如关于sqlite_popen的文档中所述,php尝试使用持久资源机制。这个机制在哪里详细描述?是否可以查看当前存储/使用的所有资源?是否可以访问此机制并存储/读取其他值?

1 个解决方案

#1


sqlite_popen uses the (executor) global hashtable "persistent_list" to store the connection resource. This hashtable is not part of the php "instance" which executes your script but of the php "runtime", which means it's not cleared/removed after the script is done but held in memory as long as the php .so/.dll/fastcgi.exe.
You cannot access EG(persistent_list) from within a php script but any php module/extension can.

sqlite_popen使用(executor)全局哈希表“persistent_list”来存储连接资源。这个散列表不是php“实例”的一部分,它执行你的脚本但是php“运行时”,这意味着它在脚本完成后没有被清除/删除但是只要php .so / .dll /就保存在内存中fastcgi.exe。你不能从PHP脚本中访问EG(persistent_list),但任何php模块/扩展都可以。

#1


sqlite_popen uses the (executor) global hashtable "persistent_list" to store the connection resource. This hashtable is not part of the php "instance" which executes your script but of the php "runtime", which means it's not cleared/removed after the script is done but held in memory as long as the php .so/.dll/fastcgi.exe.
You cannot access EG(persistent_list) from within a php script but any php module/extension can.

sqlite_popen使用(executor)全局哈希表“persistent_list”来存储连接资源。这个散列表不是php“实例”的一部分,它执行你的脚本但是php“运行时”,这意味着它在脚本完成后没有被清除/删除但是只要php .so / .dll /就保存在内存中fastcgi.exe。你不能从PHP脚本中访问EG(persistent_list),但任何php模块/扩展都可以。