0

I am in windows 7. I installed WAMPServer. Now, I can not load spatialite libraries. It is showing warning..

Warning: SQLite3::loadExtension() [sqlite3.loadextension]: Not supported in multithreaded Web servers

Here is my total configuration procedure, what I have done...

From this link I got spatialite lib. I copied "libspatialite-1.dll" and paste it to "D:\wamp\bin\php\php5.3.8\ext" which contains php extention dlls.

http://www.gaia-gis.it/spatialite-2.3.1/libspatialite-win-x86-2.3.1.zip

Then I edited php.ini file. I changed the following configuration.

.
sqlite3.extension_dir = C:\libspatialite-win-x86-2.3.1\bin
.
extension=libspatialite-1.dll
.
enable_dl = On

And lastly, I copy and paste all the libraries from my downloaded libspatialite-win-x86-2.3.1 to my project folder(libspatialite.a, libspatialite.dll.a, libspatialite.la) in my php code i write the script as follows...

<?php

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

$db->loadExtension('libspatialite.a'); 

$rs = $db->query('SELECT spatialite_version()');
while($row = $rs->fetchArray()){
    print "<h3>SQLite version: $row[0]</h3>";
}

?>

I do not know what I have done wrong or how to solve this problem?

Shahjalal
  • 1,163
  • 7
  • 21
  • 38

1 Answers1

0

Haven't seen any answer, so giving my own. I have used spatialite in C#, I think for using Spatialite Extensions you don't have to load libspatialite like a usual PHP extension, instead something similar to this should be done. (this is c# code, just trying to give you an idea)

SQLiteCommand sqliteCommand = new SQLiteCommand(String.Format("SELECT
load_extension('{0}');", "libspatialite-2.dll"), connection);
sqliteCommand.ExecuteNonQuery();

You have to execute Select load_extension("libspatialite-2.dll") on sqlite to use Spatialite. Hope this helps

Habib
  • 219,104
  • 29
  • 407
  • 436