Not this is a tricky little bugger to get working. Xdiff is a fantastic set of difference libraries for obtaining differences between files or strings. The installation on Linux was covered in a previous post but Windows was a completely different ball game. I’ve finally managed to get it working however… so here we go.
To install this you need to compile a php_xdiff.dll file. To do this you will need to obtain Visual Studio 2008 (a.k.a VC9). This opens up several problems however. To run the compiled xdiff dll file you will need to have a VC9 version of php installed. If you install a VC9 version of PHP and use apache you will need a VC9 version of Apache. See where the problems start?!!!
There is no getting away from the fact that you are going to require a VC9 version of PHP if you compile a php_xdiff.dll file. VC6 is not available any more and it makes sense to compile this with the most updated version available. This is reasonably easily fixed as PHP offer a VC9 compiled version of PHP (http://windows.php.net/download/)
This is reasonably easily fixed as well. The guys at ApacheLounge compile VC9 versions of Apache and make them readily available. See http://www.apachelounge.com/download/.
This is the more troublesome stretch of the process. There is a good guide available at http://wiki.php.net/internals/windows/stepbystepbuild for getting started. If you follow this up to the point of adding extensions you should be on good ground. One word of advice would be to download all the extensions headers and libraries available. Just make sure you have everything available. If you’ve managed to compile a version of PHP with no extensions added you’re a good way there!
When you’ve got the PHP build available it’s now time to start working on xdiff. First of all you need to obtain and compile libxdiff. The source can be obtained from http://www.xmailserver.org/xdiff-lib.html. Once you have this you need to compile it using the visual studio tools. If you’ve still got your compiler window open from compiling PHP, change to the directly where you have libxdiff extracted to and run “nmake”. This should compile some headers and library files. Once compiled you need to copy all the headers and libraries into the appropriate PHP library directories.
From here you need to follow the steps at the bottom of the PHP internals page regarding installing additional PECL extensions. This should then compile. As a note. When you give the additional “configure” command use “–with-xdiff=shared”. This will cause the library to be built as a dll file rather than compiled into php5ts.dll file.
Putting it all together
Finally you need to add the dll to the php install you insatlled earlier. Copy the dll file to the “ext” directory under the php install (with the other extensions). Edit php.ini and add the line “extension=php_xdiff.dll” into the extensions section.
Finally restart apache and you should now have xdiff functionality within PHP. If you’ve managed this… give your self a pat on the back!
I’ve uploaded the xdiff file that I compiled. If you want to use this simply install VC9 versions of PHP and Apache and place this file into the ext directory, edit the php.ini file and you’re away. It’s available here: php_xdiff.