php script unable to create pdo_sqlite database

Hi guys,

tl;dr I have plenty of disk space (215GB free) but a simple php script is unable to create a 1.6GB sqlite db file during import. I've never had this issue on dozens of other instances of running the script. Have been struggling for 8 days.

I am using the Archivarix CMS to import an 18GB .zip file.

For some reason the import tool (https://archivarix.com/en/cms/) can't create the pdo_sqlite database. The error we're getting is this:

Stack trace:

0 /home/cpanelaccountwithheld/public_html/haf.php(2973): PDO->query('SELECT * FROM s…')

1 /home/cpanelaccountwithheld/public_html/haf.php(2878): getInfoFromDatabase('sqlite:/tmp/arc…')

2 /home/cpanelaccountwithheld/public_html/haf.php(2945): getImportInfo('/home/cpanelaccountwithheld…', true)

3 /home/cpanelaccountwithheld/public_html/haf.php(7555): getImportsList()

4 {main}

thrown in /home/cpanelaccountwithheld/public_html/haf.php on line 2973

That line is this code:
$stmt = $pdo->query( "SELECT * FROM settings ORDER BY param" );

1 Reply

You need to make sure that the certain components of the path to the database have the correct ownership and permissions.

Given the path:

/this/is/the/path/to/mydb.sqlite

to the database file.

  1. The database file mydb.sqlite needs to be owned and writable by the web server
          (-rw-r--r-- www-data:www-data).
  2. The directory to needs to be owned and writable by the web server
          (-rwxr-xr-x www-data:www-data).
  3. The directory path needs to be at least group-owned & group-writable by the web server
          (-rwxrwxr-x someuser:www-data).

Don’t just make everything owned by you and world-writable…that’s a big security hole!

I've run into this a lot. It's a quirk with the sqlite PDO driver.

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct