|
From: Olly B. <ol...@su...> - 2007-06-13 15:45:36
|
On 2007-06-13, Matt Lawson <law...@ya...> wrote: > Sorry for the so many questions but I'm stuck in a > mire of OS x php versions/combinations: > > 1. If an application is made using the php4 "style" > and wrappers, will it also run on a machine that has > php5? Do you mean "is it possible to write PHP code which will run on PHP4 with SWIG-generated OO wrappers for a C++ libary, and also run on PHP5 with SWIG-generated OO wrappers for the same library"? That is possible, though there are slight differences in how some things are wrapped, mainly because PHP4 lacks various features, and I didn't want to hobble PHP5 wrappers by slavishly copying the limitations which PHP4 forces upon us. For an example of writing code to run under either, see smoketest.php, smoketest4.php, and smoketest5.php here: http://svn.xapian.org/trunk/xapian-bindings/php/ And also the examples here, which show different (but very similar) versions for PHP4 and PHP5: http://svn.xapian.org/trunk/xapian-bindings/php/docs/examples/ If you use SWIG's "-noproxy" option to generate flat function wrappers, those should work the same for PHP4 and PHP5, but I wouldn't recommend them for wrapping most C++ code. (Personally, I think PHP4's days are numbered - Linux distributions are starting to drop support for PHP4, and it's going to be less painful for most users to migrate to PHP5 rather than install their own build of PHP4 and have to deal with security updates themselves). > 2. If my development machine has php5 installed, can > I still create the php4 style/wrappers or must I > downgrade my dev machine to php4 first? You can run SWIG to generate the PHP and C/C++ wrapper code without even having PHP installed at all. To compile the C/C++ code, you'll need the relevant version of PHP installed (and the -dev or -devel package if you're using packages). There's no good reason why you can't install both at once though, certainly Debian and Ubuntu allow it - I don't know about fink or macports or whatever you might be using. If you're building from source, it's easiest to just use a different --prefix. Cheers, Olly |