Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

my local web server on one machine running Ubuntu 11.04 works fine using php5 to access sqlite3 - however on a new machine running Ubuntu 11.10 the same code, same structure, does not work at all - even though phpinfo() indicates all modules are enabled.

Any idea's on how to solve this issue?

phpinfo() on my Ubuntu 11.04 machine indicates PHP Version 5.3.5-1ubuntu7.3 but the newer Ubuntu 11.10 only supports PHP Version 5.3.6-13ubuntu3.2 ?

Why has it gone back to Ubuntu3.2?

The php code seems to be able open the database file ok, but fails when accessing a Sqlite query in the code below?

$result = $db->query('SELECT * FROM sysconfig');
$data = $result->fetchArray(SQLITE_NUM);

The variable $data returns null (however it returns data on Ubuntu 11.04 - ok)

frank

share|improve this question
1  
It has not actually „gone back”. The version number is higher (5.3.6 vs. 5.3.5). The part you are referring to is a minor Ubuntu-specific version (13ubuntu3 subversion 2). See: launchpad.net/ubuntu/oneiric/+source/php5/+changelog –  lgarzo Nov 21 '11 at 13:18

2 Answers 2

You're executing the query without checking whether its return value is sane. You may get clues as to why this is failing by looking at the return value from this:

$result = $db->query('SELECT * FROM sysconfig');

Remember that $result will be FALSE if the query didn't execute successfully. So after that line you can do:

if (!$result) {
  echo($db->lastErrorMsg());
}
share|improve this answer

Ensure you've installed the php5-sqlite package.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.