I need to open a Spatialite database by using php in a php's framework. I've already work on a basic php file to test how it work but it gave me some errors.
I've already try to load extension by using two method :
$db->loadExtension('mod_spatialite.so'); Warning: SQLite3::loadExtension(): Not supported in multithreaded Web servers in C:\applications\www\sqlite3_ext\index.php on line 19
$db->exec("SELECT load_extension('mod_spatialite.so')"); Warning: SQLite3::exec(): not authorized in C:\applications\www\sqlite3_ext\index.php on line 20
Utilities : Use a wamp (3.0.0) for a local server - PHP 7.0.0 - Mysql - Apache 2.4.17
Link to my basic php code : https://pastebin.com/t01D7xrg Link to my php.ini configuration : https://pastebin.com/HrTjnWPP
1 Answer 1
I had same trouble with the sqlite extensions loading and decide to create own shell and native php drivers and compile some win/lin binaries for here: https://github.com/eSlider/spatialite
I wrote some tests you can use as an example: https://github.com/eSlider/spatialite/blob/master/tests/SpatialShellDriverTest.php
By initializing instance of SpatialShellDriver you can add own spatialite library and/or spatialite binary path.
It should be posible to work without any problem if you use composer dependency manager. Take a look on this here: https://getcomposer.org/
Here the installation informations: https://getcomposer.org/doc/00-intro.md#installation-windows
Notice: SpatialShellDriver is slow, but it works on windows and linux without any additional installation. For linux you can use SpatialNativeDriver if you install spatialite php module.