- Date: Wed, 06 Mar 2019 10:42:36 +0000
- From: Tim Streater <tim@xxxxxxxxxxxxxxxx>
- Subject: PHP questions
I've got a couple of web sites with a hosting provider. One of them uses a small amount of PHP to log those who choose to download an app from the site (which I'm advertising on the site). That has all worked fine for some years up until recently. But I have some code that started failing:
$dbh = new SQLite3 ('dlglobals');
$reg = $dbh->querySingle ('select dlversion1, dlversion2 from globals', true);
$vsn1 = $reg['dlversion1']; // Should execute this
$vsn2 = $reg['dlversion2'];
$savc = $dbh->lastErrorCode (); // but comes here instead
$savm = $dbh->lastErrorMsg ();
$reg = $dbh->querySingle ('select sqlite_version() as vers', true);
$vers = $reg['vers'];
$str = ' (' . $vers . ' ' . phpversion() . ') ' . $savm . ' (' . $savc . ')' . "\n";
echo 'Downloading unavailable: ' . $str;
Pretty innocuous, I'd have thought, but what I'm getting is: "Downloading unavailable: (3.6.20 7.2.14) disk I/O error (10)"
I can SSH to the site and use the sqlite3 shell program to issue the same SQL select as above and that works with no issues. So I don't think the database is faulty, and I don't believe there are any real I/O errors. But before I start hassling the hosting provider I have a couple of PHP related questions.
This is a Linux hosting, which I assume is done using VMs somehow. In such cases do I get my own entire private copy of the Linux install, or is everything that would be common somehow mirrored with one copy therefore shared between all hosted clients?
More particularly, would they be likely to be generating their own build of PHP, i.e. compiling from sources? I ask this because although I'm getting PHP 7.2.14, released in January 2019, the sqlite3 module is version 3.6.20, released in November 2009. Current sqlite3 is 3.27.x or so. I've confirmed this via phpinfo(). Is there any good reason for them to be using such an old module? The sqlite3 shell I mention above is also 3.6.20.
Finally, you'll see above that I use $dbh->querySingle (...) which I assume is still valid under PHP7. As fas as I can see it should be, since the doc for SQLite3::querySingle mentions PHP7.
Comments and suggestions welcome.
Cheers -- Tim