Segmentation fault adding a new layer with php-mapscript (4.6beta3)

Nicol Hermann mapserver at GEOWORLD.DE
Mon Jun 6 10:09:00 EDT 2005


Hi Bill,

thanks for your answer. Find my answers inline.

Am Montag, den 06.06.2005, 09:47 -0400 schrieb Bill Binko:
> On Mon, 6 Jun 2005, Nicol Hermann wrote:
> > Hi List,
> > i 'am trying to build a map from the scratch using php-mapscript and the
> > lastest cvs version.
> > Whenever i add a new layer with
> > $Layer = ms_newLayerObj($map);
> > I receive a segmentation fault.
> > 
> > gdb returns the following.
> > Is this a bug?
> 
> I've tried your script, and don't get a segfault against CVS HEAD.  I have 
> a couple of suggestions, but first, some questions:
> 
> 1) Could you post your configure command line?  In particular, I'm
> interested in your --with-php= and --with-php-regex-dir= parameters.

I tried two different configure lines:

One with the sources of PHP:
./configure --with-php=/usr/local/src/php-4.3.8 --with-zlib --with-png
--without-tiff --with-jpeg --with-gd --with-freetype=/usr/local
--with-proj=/usr/local --with-postgis=/usr/local/pgsql/bin/pg_config
--with-ogr=/usr/local/bin/gdal-config
--with-gdal=/usr/local/bin/gdal-config --with-wmsclient --with-wfsclient
--with-ming --with-eppl --with-pdf=/usr/local --enable-debug=yes
--with-sde=/usr/local/sdeexe83 --with-sde-version=83 --with-sderaster
--with-wfs --with-mygis=/usr/local/mysql/bin/mysql_config
MYGIS_INC=-I/usr/local/mysql/include --with-oraclespatial=/home/oracle
--enable-point-z-m --with-wcs --with-oraclespatial=/home/oracle
--with-geos=/usr/local/bin/geos-config --with-eppl

and the other one with the installation directory:

./configure --with-php=/usr/local/include/php --with-zlib --with-png
--without-tiff --with-jpeg --with-gd --with-freetype=/usr/local
--with-proj=/usr/local --with-postgis=/usr/local/pgsql/bin/pg_config
--with-ogr=/usr/local/bin/gdal-config
--with-gdal=/usr/local/bin/gdal-config --with-wmsclient --with-wfsclient
--with-ming --with-eppl --with-pdf=/usr/local --enable-debug=yes
--with-sde=/usr/local/sdeexe83 --with-sde-version=83 --with-sderaster
--with-wfs --with-mygis=/usr/local/mysql/bin/mysql_config
MYGIS_INC=-I/usr/local/mysql/include --with-oraclespatial=/home/oracle
--enable-point-z-m --with-wcs --with-oraclespatial=/home/oracle
--with-geos=/usr/local/bin/geos-config --with-eppl

In both case i do not specify the parameter '--with-php-regex-dir'

Here is the output of the configure statement

checking for location of config.h or
php_config.h... /usr/local/include/php/main/php_config.h
checking whether we have PHP3 or PHP4... -DPHP4
checking whether we should use PHP's regex... no
        PHP/MapScript module configured.

Sadly the segfault persists.

Maybe of note PHP is compiled as cgi with the flag
'--with-regex=system'.

> 
> 2) What is the output of 'ldd php_mapscript_45.so'

ldd php_mapscript_45.so
         libcurl.so.2 => /usr/lib/libcurl.so.2 (0x4012e000)
libssl.so.0.9.7 => /usr/lib/i686/cmov/libssl.so.0.9.7 (0x4015b000)
libcrypto.so.0.9.7 => /usr/lib/i686/cmov/libcrypto.so.0.9.7 (0x4018d000)
libdl.so.2 => /lib/libdl.so.2 (0x4028c000)
        libz.so.1 => /usr/lib/libz.so.1 (0x4028f000)
        libming.so => /usr/lib/libming.so (0x402a1000)
        libclntsh.so.8.0 => /home/oracle/lib/libclntsh.so.8.0
(0x402e1000)
        libmysqlclient.so.14
=> /usr/local/mysql/lib/mysql/libmysqlclient.so.14 (0x40895000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x408f0000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x4091d000)
        libpq.so.3 => /usr/local/pgsql/lib/libpq.so.3 (0x40932000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x4094a000)
        libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x40968000)
        libpng12.so.0 => /usr/lib/libpng12.so.0 (0x409cb000)
        libgdal.so.1 => /usr/local/lib/libgdal.so.1 (0x409f1000)
        libgeos.so.2 => /usr/local/lib/libgeos.so.2 (0x40dd8000)
        libsde83.so => /usr/local/sdeexe83/lib/libsde83.so (0x40ecb000)
        libpe83.so => /usr/local/sdeexe83/lib/libpe83.so (0x41029000)
        libsg83.so => /usr/local/sdeexe83/lib/libsg83.so (0x41165000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x411a7000)
        libproj.so.0 => /usr/local/lib/libproj.so.0 (0x411f9000)
        libpdf.so.2 => /usr/local/lib/libpdf.so.2 (0x41227000)
        libgd.so.2 => /usr/local/lib/libgd.so.2 (0x412df000)
        libm.so.6 => /lib/libm.so.6 (0x4132d000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4134f000)
        libc.so.6 => /lib/libc.so.6 (0x41409000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4153d000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
        libwtc8.so => /home/oracle/lib/libwtc8.so (0x41546000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x41548000)
        libodbc.so.1 => /usr/local/lib/libodbc.so.1 (0x4155a000)
        libxerces-c.so.25 => /usr/local/lib/libxerces-c.so.25
(0x415c1000)
        libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3
(0x41956000)
        libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x4199f000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x419af000)

> 
> 3) Why is php_mapscript.so renamed to _45.so?  I don't think this is a 
> problem, but I'm curious.

I renamed php_mapscript.so to store modules which are compiled against
different versions of mapserver. 

> 
> As for the suggestions, try running configure without the
> --with-php-regex-dir= parameter.  Then, a complete rebuild (make clean
> all).

As i mentioned above i compiled mapscript without the
--with-php-regex-dir= parameter. 

> 
> If you're running a binary, then it's likely that it is built with
> the wrong choice of regex, and you'll need to rebuild or find another
> binary.
> 
> Basically, the configure script detects whether the local PHP uses the 
> system regex or the PHP builtin version.  It always has, it just does so 
> without the PHP source now.  The --with-php-regex-dir paramater was used 
> to point to the PHP source, but it should not be needed anymore.
> 
> BTW, this is just a guess, but most of the segfaults I've seen with
> php_mapscript recently have come back to this issue, so I wouldn't be
> surprised if this is what you're finding.
> 
> Bill

Many thanks for your help
Nicol



More information about the mapserver-dev mailing list