I am creating an application using spatialite database. I checked couple of tutorial from internet. Most of them explains the same. But the problem is I need "libspatialite.so" extension library. I do not know how to get it.

So whenever i run my code it shows the following warning and error....

[Warning: SQLite3::query() [sqlite3.query]: Unable to prepare statement: 1, no such module:]
[Fatal error: Call to a member function fetchArray() on a non-object]

But my code looks OK. It looks like because of i could not load the extention "libspatialite.so"

I have given bellow, my code.


$db = new SQLite3('sixcommunes.sqlite'); 


$db->exec("SELECT InitSpatialMetadata()");

$rs = $db->query('SELECT sqlite_version()');

while ($row = $rs->fetchArray()) {
    print "<h3>SpatialLite version: $row[0]</h3>";

$sql = "SELECT KOM_NAMN FROM '6communes_SWEREF99TM'";

$rs = $db->query($sql);
$msg = "";
while($row = $rs->fetchArray()){
        $msg = $row[0];
    print "<h3>$msg</h3>";

1 Answer 1


What computer? If Ubuntu/Debian, try:

sudo apt-get install libspatialite-dev
  • My computer is windows 7. It this case what should I do?
    – Shahjalal
    Mar 21, 2012 at 9:51
  • .so files are for Unix-like systems. For Windows, you need to find a DLL equivalent.
    – Mike T
    Mar 21, 2012 at 10:58
  • Thanks for help. I have the windows dll. I do not know how should I configure my wampserver. Could you please read the following question, if you can help me somehow. gis.stackexchange.com/questions/22064/…
    – Shahjalal
    Mar 21, 2012 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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