On 24 Aug 2015, at 3:03pm, Luc Andre <landre3567 at gmail.com> wrote:

> PHP Notice: SQLite3Stmt::execute(): Unable to execute statement: database
> is locked
> SQLite3::prepare(): Unable to prepare statement: 5, database is locked
> SQLite3::querySingle(): Unable to execute statement: database is locked
> 
> We can not understand how a read only file can get locked.

Although the connection you're using is readonly, another program may have the 
same database file open for writing.  So your readonly thread has to check to 
see that nothing is making changes to the file.  Occasionally two of your 
threads make this check at the same time and argue with one-another about who 
goes first.

> Any hint / fix ?

For every connection to the database set a timeout using this function:

<http://php.net/manual/en/sqlite3.busytimeout.php>

which will look something like

$dbConnection->busyTimeout(300000);

I'm using 5 minutes just to give an unattended program time to survive a 
network problem.  I don't expect any access to every really take 5 minutes.

Simon.

Reply via email to