View Ticket
Not logged in
Ticket Hash: f65f05b71a2f8ca15ca6a2316d0e53db77ffbe70
Title: InitSpatialMetadata() seg faults with PHP MapScript extension
Status: Closed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Resolution: External_Bug
Last Modified: 2020-09-25 13:44:45
Version Found In: 4.3
User Comments:
anonymous added on 2020-09-08 22:31:04:
I am using SQLite and SpatiaLite and the PHP mapscript extension together.  When I execute InitSpatialMetadata() from within PHP I get a seg fault.  

$ git clone https://github.com/captain-igloo/mapserver

$ docker build -t mapserver -f .docker/Dockerfile .

$ docker run -it -rm mapserver /bin/bash

# php /test.php
Segmentation fault (core dumped)

test.php contains:

<?php

$db = new SQLite3('test.db');

$db->loadExtension('mod_spatialite.so');

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

anonymous added on 2020-09-11 01:28:09:
I have upgraded to PHP 7.4 and I no longer get the seg fault. (I am the OP)

sandro added on 2020-09-25 13:44:45:
loading SpatiaLite as an external module (mod_spatialite) can easily get troubles if depending libraries of old versions are found.

this is often the case of complex frameworks as Java, Phyton and PHP

if you are interested in going in more depth you can usefully read this discussion about Python, but it surely applies to PHP as well:

https://groups.google.com/forum/#!topic/spatialite-users/ecEEpxbDROk