felladrin / online-visitors-counter

Real-time online visitors counter using Ajax, PHP PDO and SQLite.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not find driver

mitchellkrogza opened this issue · comments

Hi there, tried your nice little counter but I get a "Could not find driver" error ? I am running it on PHP 7.0.30-0ubuntu0.16.04.1

Hi, Mitchell. Thanks for using it!

Can I ask you if you're using any panel to manage the php install (like cPanel/VestaCP)? Or did you install php manually on ubuntu?

In any case, installing PDO SQLite extensions to PHP7 should solve it.

If running directly on Ubuntu, you could try "sudo apt install php7.0-pdo-sqlite". (I see it's available on Ubuntu repositories).

If running through a panel, probably you can install the extensions through it.

Let me know if you have it already. If so, I can investigate further.

Oh awesome and thanks for the reply. Yes it's a manual install and I figured it was missing a php extension. I'll give it another whirl in the morning and get back to you.

Hi @felladrin ok one step closer, now I get the following error SQLSTATE[HY000] [14] unable to open database file

Ok fixed with the following commands on Ubuntu 16.04, might help future users.

sudo apt install php7.0-pdo-sqlite
sudo touch counter.sqlite
sudo apt install sqlite3
sqlite3 counter.sqlite "CREATE TABLE 'online' ('id' TEXT PRIMARY KEY NOT NULL, 'page_title' TEXT, 'page_url' TEXT, 'last_activity' INTEGER)"

Hi @mitchellkrogza! Glad you got it working.
Good point about installing sqlite3.
About the manual command to create the table, I'm sure you just needed to do that because of the folder permission. Otherwise the php script would have created it, as stated on line 18.
Thanks for this info. I'm gonna update the README with your discoveries now.

Awesome glad I could help and thanks for a really great visitor counter that just works.