Build MapServer on Linux

General information on Unix builds can be found in the UNIX Compilation and Installation HOWTO:

See also the MapServerCompilation page which contains links to detailed instructions for various platforms and MapServer versions.

Build PHPMapScript on Linux

Also see PHPBuildDebugLinux. The PHPMapScript page also contains links to other resources including detailed instructions for specific platforms such as RedHat and Debian.

Compiling MapServer and PHPMapScript in Spanish language is available on SpanishLinuxInstall?.

I finally have this all working after a long ordeal. But before I go into the details, I want to give public THANKS to Daniel Morissette of DM Solutions Group. He provided significant support and advice that enabled me to work through many issues. I seems straight forward after the fact, but it was not intuitive and I seemed to have turn down every dead end that exsisted. So Daniel, Thanks!, your assistance is greatly appreciated.

Now the details before they escape my seive of brain.

My configuration:

  RedHat 6.2, Linux 2.2.18
  mapServer 3.5 Released

I made scripts with all the configure parameters so I could have some repeatability and to verify what I actually ran last. I also did a "make clean" and "rm config.cache" in the scripts so when I made changes I was sure they were used.

Here are a few of the problems that I ran into:

1) building things as DSO is very different than build things as static or CGI. After I got PHP3 built for debugging and found out that my multiple version of regex was causing memory structures to be miss-aligned, it still took me another half a day to get a working version to build. And worst of all the interdependance between apache/php /mapscript is pathological at best.

2) TOO many versions of regex! There is one bundled with apache, another one bundled with php3, a system version(regex.h) and an rx lib version. Everybody needs to use the SAME version. I could ONLY get things to work when I forced everyone to use the system-regex. First off if you read the WMS documentation it talks about rx lib, just forget about this (IE: Dont down load it! I did and had to uninstall it to get mapserver to build in the first place). This required finding and setting --disable-rule=WANTHSREGEX=no in apache so it does not use its bundled version.

For PHP3, if you are building the CGI version then you can specify --with-system-regex and your home free, BUT if your building a DSO with --with-apxs=/usr/sbin/apxs then it will look at the /usr/sbin/apxs to see if apache was built with its bundled regex and if it was then it will ignore the --with-system-regex. Also when you configure mapserver, it will look at the php's config.h file to determine if it should use the php bundled version of regex or not.

3) Build PHP3 as a DSO. There is a nasty problem that apxs is broken. This is easily fixed if you edit /usr/sbin/apxs and search for "-shared" and insert before it "-export-dynamic " before you run make on php3. Also be aware that if you rebuild and install apache it you will need to fix apxs again.

4) All the options as defined in ./configure --help do NOT work correctly or are ignored because of other conditions which allow you to easily get very confused. For example, --without-apxs or --with-apxs=no do not work, --without-system-regex does not work There may have been others, but I can't remember.

5) Open Issues:

a) I never got the CGI version of PHP3 to work with my build of apache. b) When I build apache using the config below php4 broke and I have not gone back to look into that issue.

So like I said, it seems pretty simple in hindsight, but I had spent the better part of 5 days over the last 2 weeks working on this. It was easier to set up my Linux firewall :)

My scripts for apache, php3 and mapserver follow:

[woodbri@linus linux]$ cat doit-apache
make clean
rm config.cache

[woodbri@linus linux]$ cat doit-php3
make clean
rm config.cache
make install

[woodbri@linus mapserver]$ cat doit-3.5
make clean
rm config.cache
--with-ogr --with-gdal  
Last modified 10 years ago Last modified on Jan 29, 2009 2:09:06 PM