Skip to content
Advertisement

check for existing, persistent SQLite connection in PHP

PHP supports the use of persistent SQLite connection. However, problem arises in trying to run maintenance scripts (like file backup), with such a connection opened. These scripts are likely to be run without a server restart every now and then, on periods of low traffic.

The question is : How to check if there is currently an SQLite persistent connection, without opening / calling one (hence creating the connection).

See: php SQLite persistent connection

Advertisement

Answer

If you have access to shell_exec() or exec you can run a shell command to check to see if a sqlite process is running using something like top or maybe a command like lsof -i -n -P | grep sqlite assuming sqlite is the name of the process.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement