[Mapserver-dev] Re: Working PHP Mapscript module produced with SWiG?!

Paul Ramsey pramsey at refractions.net
Thu Mar 18 13:08:08 EST 2004


Congratulations Mark, I am frankly surprised at how much the SWIG PHP4 
support has improved since my last try. I did manage to compile a 
working .so last year, but "working" is a loose use of the work. Many of 
the functions did not work, and subobjects were flaky at best.

Good news!

Is there an implication here that it might be possible to compile a php 
version of mapscript without the php source tree now? This could make 
rpm'i'fication of a swig'ed php mapscript much more straightforward.

P.

Mark Cave-Ayland wrote:
> Hi Paul/Developers,
> 
> In response to your email, I've just had a play at using SWiG to
> generate a PHP Mapscript module and I'm pleased to report back that I
> have managed to produce a working mapscript.so module by running SWiG on
> the mapscript.i file :)
> 
> The setup I used was:
> 
> 	PHP 4.3.3
> 	SWiG 1.3.21
> 	Mapserver 3.6.6
> 
> I was hoping to also test Mapserver 4, but unfortunately our new
> development server running Mapserver 4 is also running PHP5, and alas
> SWiG doesn't yet support PHP5.
> 
> To do this, I created a new directory called php4 in the mapscript/
> directory and created a symlink to mapscript.i. The resulting wrapper
> file was generated (with warnings) using:
> 
> 	swig -php4 mapscript.i
> 
> and compiled using the attached build.sh script. During compilation I
> received two warnings which were given below:
> 
> mapscript_wrap.c: In function `_wrap_labelObj_wrap_get':
> mapscript_wrap.c:9087: warning: initialization makes pointer from
> integer without a cast
> mapscript_wrap.c: In function
> `_wrap_resultCacheMemberObj_classindex_get':
> mapscript_wrap.c:13820: warning: initialization makes pointer from
> integer without a cast
> 
> The only gotcha I found was that it was necessary to specify all the
> libraries used by the mapscript module using -l when generating the
> shared library, otherwise PHP would give an 'undefined symbol' error
> when the module was loaded with dl().
> 
> As a quick test I took a test script I wrote in Perl Mapscript and
> converted it into PHP Mapscript (also attached) and was absolutely
> stoked when it worked. I don't know how we should go about
> comprehensibly testing this, but I thought I would report back to the
> list that the module compiles and appears to work. Do we have any way
> testing that all the functions are working correctly? It would be great
> to see a unified Mapscript, especially as developers are working on
> bringing together the documentation :)
> 
> 
> Cheers,
> 
> Mark.
> 
> ---
> 
> Mark Cave-Ayland
> Webbased Ltd.
> Tamar Science Park
> Derriford
> Plymouth
> PL6 8BX
> England
> 

-- 
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632
      \_




More information about the mapserver-dev mailing list