简体   繁体   English

在WHM64升级后无法访问eximstats sqlite3 db

[英]Cant access eximstats sqlite3 db after WHM64 upgrade

After WHM 64 upgradation, cant access eximstat db. WHM 64升级后,无法访问eximstat db。 MySQL code changed to PDO for accessing sqlite3 db as follows: MySQL代码更改为PDO以访问sqlite3 db,如下所示:

$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. 事实上,在var / cpanel目录中创建了一个新的空白文件,而不是连接到eximstats db。 Surprisingly, CPanel:'View Sent summary' fetch information all correctly, But I cant access in my script which is residing on the domain. 令人惊讶的是,CPanel:“查看已发送摘要”可以正确获取所有信息,但我无法访问驻留在域中的脚本。

Any help is greatly appreciated. 任何帮助是极大的赞赏。

Thanks!! 谢谢!!

During a chat with the excellent support of cPanel, we figured out this: 在与cPanel的出色支持下聊天时,我们发现了这一点:

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. 这是eximstats_db.sqlite3表的权限问题:您尝试以非root用户身份访问数据库,但数据库由root拥有,只能由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: 理论上,您应该能够通过将SQLITE3_OPEN_READONLY标志传递给调用来直接访问该文件,以打开文件,如下所示:

https://secure.php.net/manual/en/sqlite3.open.php https://secure.php.net/manual/en/sqlite3.open.php

So granting read access to eximstats_db.sqlite3 tables (NB! there are 3 of them): 因此授予对eximstats_db.sqlite3表的读访问权限(NB!其中有3个):

-rw----r-- 1 root root 135168 Jun 10 06:06 eximstats_db.sqlite3
-rw----r-- 1 root root 32768 Jun 12 14:34 eximstats_db.sqlite3-shm
-rw----r-- 1 root root 1058512 Jun 12 14:34 eximstats_db.sqlite3-wal

and using 和使用

$dbh = new SQLite3('/var/cpanel/eximstats_db.sqlite3',SQLITE3_OPEN_READONLY);

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. 它似乎是PHP中SQlite3库的限制:即使对于只读访问,它也希望锁定对文件的访问。 So you need to give them also write access: 所以你需要给他们写访问权限:

-rw----rw- 1 root root 135168 Jun 10 06:06 eximstats_db.sqlite3
-rw----rw- 1 root root 32768 Jun 12 14:34 eximstats_db.sqlite3-shm
-rw----rw- 1 root root 1058512 Jun 12 14:34 eximstats_db.sqlite3-wal

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: 如果您无法更改这些数据库文件的权限,那么我能看到的唯一解决方案是将文件复制到域,更改其中的权限,然后使用这些文件:

$target = '/var/cpanel/eximstats_db.sqlite3-shm';
$newfile = '/home/yourdomain/where/your/script/is/eximstats_db.sqlite3';
copy($target, $newfile);
chmod($newfile, 0777);
// same with all 3 files..
$dbh = new SQLite3('eximstats_db.sqlite3'); // not '/var/cpanel/eximstats_db.sqlite3'!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM