PHP/Mapscript 4.6.0 build fails when PHP is DSO/--with-regex=php

Steven Monai stevem at SPATIALMAPPING.COM
Thu Aug 11 14:16:41 EDT 2005


Greetings, all:

First, some context:
I just got around to upgrading MapServer to 4.6.0 (from 4.4.1), and I'm
having a problem building the php_mapscript module. I'm running Slackware
Linux 10.0, Apache 1.3.33, and PHP 4.3.10. PHP was built from source with a
script that actually builds PHP twice: the first build creates an apache
DSO using --with-apxs=/usr/sbin/apxs and --with-regex=php (plus lots of
other configure switches, see below for the complete list); the second
build creates the CGI and CLI interpreters using --with-regex=system (plus
lots of others, see below).

Now my problem:
When I configure MapServer --with-php pointing to my PHP CGI/CLI build
directory, php_mapscript.so successfully compiles. However, when I
configure MapServer --with-php pointing to my PHP DSO build directory, the
MapServer build fails with compilation errors. The failing gcc command and
the corresponding error message appear as follows (I have saved the
complete log, if anyone would like to see it):

gcc -fPIC -O2 -fPIC -Wall   -DUSE_PHP_REGEX -DCOMPILE_DL=1 -DPHP4 -
USE_WMS_LYR -DUSE_WFS_LYR  -DUSE_WFS_SVR -DUSE_WMS_SVR    -DUSE_POSTGIS  -
DUSE_GDAL -DUSE_OGR    -DUSE_THREAD -DUSE_PROJ    -DUSE_GD_GIF -
DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_GDIMAGEGIFPTR -
DGD_HAS_GETBITMAPFONTS -DUSE_ICONV  -I/usr/local/src/mapserver-4.6.0 -
I/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/..      -
I/usr/local/pgsql/include  -I/usr/local/include   -I/usr/local/include  -
I/usr/local/include   -I/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build -
I/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/dl -
I/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/main -
I/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/Zend -
I/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/include -
I/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/TSRM  -
I/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/.. -c -
o /usr/local/src/php/pkg_tmp/php-4.3.10-dso-
build/regex/regerror.o /usr/local/src/php/pkg_tmp/php-4.3.10-dso-
build/regex/regerror.c
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:38: error:
`REG_OKAY' undeclared here (not in a function)
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:38: error:
initializer element is not constant
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:38: error:
(near initialization for `rerrs[0].code')
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:38: error:
initializer element is not constant
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:38: error:
(near initialization for `rerrs[0]')
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:39: error:
initializer element is not constant
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:39: error:
(near initialization for `rerrs[1]')
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:40: error:
initializer element is not constant
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:40: error:
(near initialization for `rerrs[2]')
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:41: error:
initializer element is not constant
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:41: error:
(near initialization for `rerrs[3]')
/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build/regex/regerror.c:42: error:
initializer element is not constant
.... (and so on; snipped for brevity) ....

Strangely, the failure occurs while compiling regerror.c within the PHP
source tree. It is clear that the above error is caused by my PHP DSO
configuration, since my PHP CGI/CLI config works just fine with MapServer.
Any ideas what's going on here?

Additional details:
The following are complete listings of the ./configure switches I used to
build PHP and MapServer, just in case anyone wants to see them.

Here are the PHP configure switches common to both the DSO and CGI/CLI
builds:
  --prefix=/usr
  --sysconfdir=/etc
  --enable-discard-path
  --with-config-file-path=/etc/apache
  --enable-safe-mode
  --with-openssl
  --with-mhash
  --enable-bcmath
  --with-bz2
  --with-pic
  --enable-calendar
  --enable-ctype
  --with-gdbm
  --with-db3
  --enable-dbase
  --enable-ftp
  --with-iconv
  --with-exif
  --enable-exif
  --with-gd=/usr/local
  --with-jpeg-dir=/usr
  --with-png-dir=/usr
  --with-zlib-dir=/usr
  --with-freetype-dir=/usr/local
  --with-gmp
  --with-pgsql=/usr/local/pgsql
  --with-curl=/usr
  --with-mysql=shared,/usr
  --with-gettext=shared,/usr
  --with-expat-dir=/usr
  --with-xml
  --enable-wddx
  --with-mm=/usr
  --enable-trans-sid
  --enable-shmop
  --enable-sockets
  --enable-sysvsem
  --enable-sysvshm
  --enable-yp
  --enable-memory-limit
  --with-tsrm-pthreads
  --enable-shared
  --disable-debug
  --with-zlib=/usr

Here are the additional switches used specifically for the PHP DSO build:
  --disable-static
  --with-apxs=/usr/sbin/apxs
  --with-regex=php

Here are the additional switches used specifically for the PHP CGI/CLI
build:
  --enable-force-cgi-redirect
  --enable-fastcgi
  --enable-pcntl
  --enable-sigchild
  --with-regex=system

Finally, here are ./configure switches used to build php_mapscript.so for
use with DSO PHP (when building it for use with CGI PHP, only the last
switch is different):
  --with-gd=/usr/local
  --with-jpeg=/usr
  --with-freetype=/usr/local
  --with-zlib=/usr
  --with-png=/usr
  --without-tiff
  --without-eppl
  --with-proj=/usr/local
  --with-threads
  --with-gdal=/usr/local/bin/gdal-config
  --with-ogr
  --with-postgis=/usr/local/pgsql/bin/pg_config
  --with-wfs
  --with-wmsclient
  --with-wfsclient
  --with-curl-config=/usr/bin/curl-config
  --disable-ignore-missing-data
  --disable-debug
  --with-php=/usr/local/src/php/pkg_tmp/php-4.3.10-dso-build

Thanks,
-SM
--


On Mon, 6 Jun 2005 10:21:58 -0400, Bill Binko <bill at BINKO.NET> wrote:

>On Mon, 6 Jun 2005, Camden Daily wrote:
>
>> Is this the link for it?
>>
>> http://cvs.gis.umn.edu/dist/mapserver-4.6.0-beta3.tar.gz
>
>That's the one!
>
>>
>> I had previously been building PHP with the option
>> '--with-regex=system'.  Will I still need to configure PHP in this
>> way?
>
>No, you should be able to run with either regex now.  That makes running
>against pre-built PHP binaries much simpler.  You do need to have the PHP
>#include files.
>
>You also do not need the --with-php-regex-dir parameter.  Just use
>--with-php=/usr or wherever your #includes are.
>
>Bill



More information about the mapserver-users mailing list