[mapserver-users] SOLVED: MS 3.5 PHP3 MapScript Install

Stephen Woodbridge woodbri at swoodbridge.com
Sat Jan 5 10:50:33 EST 2002


Dan,

I finially got this to install. I could not get the instructions on
dmsolutions.ca site to work so you might want to try them yourself.

Here is what did work.

Redhat 6.2 with Linux 2.2.18
apache_1.3.22
php-3.0.18
mapserver 3.5 released code

I configured apache with:
./configure \
--enable-module=all \
--enable-shared=max \
--with-layout=RedHat

I configured php3 with:
# PHP must be configured --without-ttf because we are using a
# conflicting version in MapScript! see:
#
http://www2.dmsolutions.ca/mapserver/php_mapscript/php_mapscript_faq.html#4.4

./configure \
--prefix=/usr \
--with-apxs=/usr/sbin/apxs \
--with-config-file-path=/etc/httpd \
--enable-safe-mode \
--enable-versioning \
--enable-force-cgi-redirect=yes \
--enable-discard-path=yes \
--with-exec-dir=/usr/bin \
--with-system-regex \
--disable-debug \
--with-zlib \
--with-gdbm \
--enable-debugger \
--enable-magic-quotes \
--enable-track-vars \
--enable-sysvsem \
--enable-sysvshm \
--enable-track-vars \
--with-xml \
--with-ftp \
--with-jpeg \
--without-ttf \
--with-gd \
--with-mysql=/usr

When you run make the last command to execute is /usr/sbin/apxs which
echos two lines starting with gcc. The first is to complie mod_php3.c
and the second is the important one which links libphp3.so as a shared
object. Unfortunately, the APXS command does NOT use the LDFLAGS
variable.

My fix was to copy the last line of output (in my case):

gcc -shared -o libphp3.so mod_php3.o libmodphp3-so.a -L/usr/local/lib
-lpng -lz -ljpeg -lgd -L/usr/lib/mysql -lmysqlclient -lgdbm -lz -lgdbm
-lpam -ldl -lcrypt -ljpeg -lttf -lpng -lgd -lresolv
-Wl,--version-script=/home/woodbri/linux/php-3.0.18/php.map -Wl,-rpath
/usr/lib/mysql

and added -rdynamic in front of -shared  (THIS DID NOT WORK)
so I tried -export-dynamic (THIS DID WORK):

gcc -export-dynamic -shared -o libphp3.so mod_php3.o libmodphp3-so.a
-L/usr/local/lib -lpng -lz -ljpeg -lgd -L/usr/lib/mysql -lmysqlclient
-lgdbm -lz -lgdbm -lpam -ldl -lcrypt -ljpeg -lttf -lpng -lgd -lresolv
-Wl,--version-script=/home/woodbri/linux/php-3.0.18/php.map -Wl,-rpath
/usr/lib/mysql

I then su; make install; and restarted apache and the
phpinfo_mapscript.php3 script works and shows the MapScript config info.

The strange thing with php3 is that I removed the -shared from LDFLAGS
and did a make clean; make > log then check for "shared" and it only
shows up in the APXS command which means that LDFLAGS is not being used
by the make all targets.

I hope this helps someone else.

-Steve Woodbridge
 http://swoodbridge.com

Stephen Woodbridge wrote:
> 
> OK, So I read that before and my system had mod_so so I thought it was
> OK, but I guess not. That's OK, I decided to built a newer apache with
> DSO and fought through a plague of problems and finally got apache and
> php3 working as DSO (but I still have to go back and fix php4 and
> mod_perl which broke doing this) ...
> 
> NEW PROBLEM! (I seem to get stuff on regex stuff alot :)
> 
> Now I tried to rebuild mapserver 3.5 with mapscript using:
> 
> ./configure \
>   --with-perl-options=PREFIX=/usr \
>   --with-ogr --with-gdal --with-wmsclient --with-proj \
>   --with-php=/home/woodbri/linux/php-3.0.16 \
>   --with-apxs=/usr/sbin/apxs
> 
> and get down to:
> 
> gcc -c -O2  -Wall -DIGNORE_MISSING_DATA  -DUSE_EPPL -DUSE_PROJ
> -DUSE_PROJ_API_H -DUSE_WMS -DUSE_WMS_LYR  -DUSE_TIFF -DUSE_JPEG
> -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_TTF
> -DGD_HAS_GDIMAGEGIFPTR   -DUSE_OGR -DUSE_GDAL   -I/usr/include
> -I/home/woodbri/linux/php-3.0.16/regex  -I/usr/local/include
> -I/usr/local/include  -I/usr/local/include
> -I/usr/local/include/w3c-libwww -DHAVE_CONFIG_H
> /home/woodbri/linux/php-3.0.16/regex/regcomp.c -o
> /home/woodbri/linux/php-3.0.16/regex/regcomp.o
> In file included from /home/woodbri/linux/php-3.0.16/regex/regcomp.c:14:
> /home/woodbri/linux/php-3.0.16/regex/cclass.h:8: warning: missing braces
> around initializer for `cclasses[0]'
> 
> and a whole lot more warnings like the last until make dies!
> 
> I assume that the references to my php dir are an attempt to reuse the
> regex code built into php. Does this mean I need to configure php
> differently or what? And since I JUST built php WHY is it compiling it
> again and putting the .o back over there instead of locally!
> 
> OK, Don't ask me why (I didn't do a make clean on php) but that dir had
> not been built, presumably because php picked up the regex which is
> installed as a system library. I did a make in this dir and went back to
> mapserver and every think built ok.
> 
> So, I  cp php_mapscript.so /etc/httpd/modules/  over and say cool now I
> can get the mapscript/php test to work .... NO such luck!!!!
> I still get the:
> 
> [Fri Jan  4 22:26:31 2002] [notice] Accept mutex: sysvsem (Default:
> sysvsem)
> httpd: error in loading shared libraries:
> /usr/lib/apache/php_mapscript.so: undefined symbol:
> _register_list_destructors
> 
> So 5 hours later and I'm back where I started. I must have mised
> something. Maybe a good nights sleep and I will see it in the morning.
> 
> [root at linus httpd]# /sbin/httpd -l
> bash: /sbin/httpd: No such file or directory
> [root at linus httpd]# /usr/sbin/httpd -l
> Compiled-in modules:
>   http_core.c
>   mod_so.c
> suexec: disabled; invalid wrapper /usr/sbin/suexec
> 
> phpinfo() reports:
> 
> Configure command: ./configure '--prefix=/usr'
> '--with-apxs=/usr/sbin/apxs' '--with-config-file-path=/etc/httpd'
> '--enable-safe-mode'
>     '--enable-versioning' '--enable-force-cgi-redirect=yes'
> '--enable-discard-path=yes' '--with-exec-dir=/usr/bin'
> '--with-system-regex'
>     '--disable-debug' '--with-zlib' '--with-gdbm' '--enable-debugger'
> '--enable-magic-quotes' '--enable-track-vars' '--enable-sysvsem'
>        '--enable-sysvshm' '--enable-track-vars' '--with-xml'
> '--with-ftp' '--with-jpeg' '--without-ttf' '--with-gd'
> '--with-mysql=/usr'
> 
> php3.ini file path is set to: /etc/httpd
> 
> I checked to make sure I have the -rdynamic in the php Makefile, NO the
> little beggar some how escaped again! It it a real pain to keep adding
> it and losing it every time you run configure. So I add it again; make
> clean; make; su; make install; restart apache; Still does not work!
> 
> I appreaciate the help. This falls into the "It just isn't easy!"
> catagory.
> 
> -Steve
> 
> Daniel Morissette wrote:
> >
> > Stephen Woodbridge wrote:
> >
> > >Additional info:  THe apache error_log has:
> > >
> > >httpd: error in loading shared libraries:
> > >/usr/lib/apache/php_mapscript.so: undefined symbol:
> > >_register_list_destructors
> > >
> > >in it. So this looks like the problem, but How do I fix it?
> > >
> > This happens if your  php executable (if you compiled PHP as a CGI) or
> > your httpd binary (if PHP is compiled statically into Apache) was not
> > linked to support loading shared libraries.  It has to be relinked using
> > the "-rdynamic" option (on Linux) which will allow loading of shared
> > libraries.
> >
> > See also:
> > http://www2.dmsolutions.ca/mapserver/php_mapscript/php_mapscript_faq.html#4.3
> >
> > Daniel



More information about the mapserver-users mailing list