After WHM 64 upgradation, cant access eximstat db. MySQL code changed to PDO for accessing sqlite3 db as follows:
$db = new PDO('sqlite:/var/cpanel/eximstats_db.sqlite3', DB_USER, DB_PASSWORD);
The failues, defers tables are all blank. In fact, a new blank file was getting created in the var/cpanel directory, instead of getting connection to eximstats db. Surprisingly, CPanel:'View Sent summary' fetch information all correctly, But I cant access in my script which is residing on the domain.
Any help is greatly appreciated.
Thanks!!
During a chat with the excellent support of cPanel, we figured out this:
It is a problem with rights for eximstats_db.sqlite3 table: you are trying to access the database as a non-root user, but database is owned by root and only writable by root.
In theory you should be able to access the file directly by passing the SQLITE3_OPEN_READONLY flag to the call to open the file as outlined here:
https://secure.php.net/manual/en/sqlite3.open.php
So granting read access to eximstats_db.sqlite3 tables (NB! there are 3 of them):
and using
should work, but it doesn't. It appears to be a limitation with the SQlite3 library within PHP: even for read-only access it wants to lock access to the file. So you need to give them also write access:
That's that. After that, you'll see the defers, failures and other tables.
(Of course, in real life you might want to create a group and give read-write access to that group only, not everybody).
If you are not able to change permissions to these database files then the only solution I can see is to copy the files to domain, change the permissions there and then use these files instead: