SQLite3 Cannot write database file on Amazon AWS, but only in certain cases

I have an installation and an EC2 instance on AWS, and as part of this instance I use a SQLite3 database to process certain data. All database operations are routed through a single PHP file with one connection:

function dataQuery($query)
{
    // establish database connection
    try
    {
        $dbh = new PDO(DBW); // try windows first
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    catch(PDOException $e)
    {
        echo $e->getMessage();
        $errorCode = $e->getCode();

        // windows not available, try linux
        if('14' == $errorCode)
        {
            try
            {
                $dbh = new PDO(DBL); // try linux
                $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            }
            catch(PDOException $e)
            {
                echo $e->getMessage();
                $errorCode = $e->getCode();
            }
        }
    }

    // try to run query
    try
    {
        $queryResults = $dbh->query($query);
        if($queryResults != null)
        {
            $results = $queryResults->fetchAll(PDO::FETCH_OBJ); // always return an object
            $queryResults = NULL; // closes the connection
            return $results;
        }
    }
    catch(PDOException $e)
    {
        $errorMsg = $e->getMessage();
        return $errorMsg;
    }
}

DBWand DBLare constants defined only a few lines earlier. The error I get is:

could not find driver

"Why is this weird?" you ask. “Because the problem is not consistent,” I reply. Let me clarify ...

The first action that happens when someone goes to a site is a login that requires reading and writing to the database. This works great (how the application works on any "normal" server).

2|Jay Blanchard|jayblanchard@thewebsite.com|foo|{"roles":["admin", "surveyor"]}|2015-06-04 15:32:29|69.1.164.40

, , - . .

, , . , , :

drwxrwxrwx 10 ubuntu ubuntu 4096 Jun  4 15:32 application-gateway

:

-rwxrw-rw-  1 ubuntu ubuntu  65536 Jun  4 15:32 application.db

, , ubuntu .

, , PDO /etc/php5/apache2/conf.d/

lrwxrwxrwx 1 root root   32 Jun  3 15:29 05-opcache.ini -> ../../mods-available/opcache.ini
lrwxrwxrwx 1 root root   28 Jun  3 15:29 10-pdo.ini -> ../../mods-available/pdo.ini
lrwxrwxrwx 1 root root   29 Jun  3 15:29 20-json.ini -> ../../mods-available/json.ini
lrwxrwxrwx 1 root root   31 Jun  3 15:33 20-mysqli.ini -> ../../mods-available/mysqli.ini
lrwxrwxrwx 1 root root   30 Jun  3 15:33 20-mysql.ini -> ../../mods-available/mysql.ini
lrwxrwxrwx 1 root root   34 Jun  3 15:33 20-pdo_mysql.ini -> ../../mods-available/pdo_mysql.ini
lrwxrwxrwx 1 root root   33 Jun  3 15:29 20-readline.ini -> ../../mods-available/readline.ini
lrwxrwxrwx 1 root root   35 Jun  3 20:17 pdo_sqlite.ini -> ../../mods-available/pdo_sqlite.ini

, . . , .

PDO PHP -

PHP Info AWS?

+4
1

, , .

- . , CRON exec PHP -. PHP PHP CLI.

script , . , (. ) , .

SQLite3 PHP CLI. , SQLite PHP CLI, , .

ubuntu@foo:/etc/php5/cli/conf.d$ ls -la
total 8
drwxr-xr-x 2 root root 4096 Jun  4 19:16 .
drwxr-xr-x 3 root root 4096 Jun  3 15:29 ..
lrwxrwxrwx 1 root root   32 Jun  3 15:29 05-opcache.ini -> ../../mods-available/opcache.ini
lrwxrwxrwx 1 root root   28 Jun  3 15:29 10-pdo.ini -> ../../mods-available/pdo.ini
lrwxrwxrwx 1 root root   29 Jun  3 15:29 20-json.ini -> ../../mods-available/json.ini
lrwxrwxrwx 1 root root   31 Jun  3 15:33 20-mysqli.ini -> ../../mods-available/mysqli.ini
lrwxrwxrwx 1 root root   30 Jun  3 15:33 20-mysql.ini -> ../../mods-available/mysql.ini
lrwxrwxrwx 1 root root   34 Jun  3 15:33 20-pdo_mysql.ini -> ../../mods-available/pdo_mysql.ini
lrwxrwxrwx 1 root root   35 Jun  4 19:15 20-pdo_sqlite.ini -> ../../mods-available/pdo_sqlite.ini
lrwxrwxrwx 1 root root   33 Jun  3 15:29 20-readline.ini -> ../../mods-available/readline.ini
lrwxrwxrwx 1 root root   32 Jun  4 19:16 20-sqlite3.ini -> ../../mods-available/sqlite3.ini
+2

All Articles