5

I can't believe this hasn't been asked before, but here goes:

I'm trying to install xdiff on Windows (64-bit) using WAMP and PHP version 5.3.

pecl.php.net doesn't offer a .dll file for this combination so I tried downloading the 5.3 x86 files and the 5.5 x64 versions, but neither worked. The x86 version generated the following warning in the apache logs:

[Thu Jun 05 15:55:47 2014] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.13/ext/php_xdiff.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.13/ext/php_xdiff.dll' - %1 is not a valid Win32 application.

in Unknown on line 0

The x64 version generated this warning:

[Thu Jun 05 15:58:16 2014] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.13/ext/php_xdiff.dll' - The specified module could not be found.\r\n in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.13/ext/php_xdiff.dll' - The specified module could not be found.

in Unknown on line 0

At that point, I went back and read the readme file a little more closely and discovered the following line:

This extension requires libxdiff (http://www.xmailserver.org/xdiff-lib.html).

Okay, fair enough. Following the advice on this page I compiled libxdiff but then I got to the step that read

Once compiled you need to copy all the headers and libraries into the appropriate PHP library directories.

And I have no idea what the "appropriate PHP library directories" are nor what files I'm supposed to be copying, nor even if the missing libxdiff is the problem (or if the real problem is that the .dll file I'm using is just incompatible with PHP 5.3 x64 and I should be trying to compile the PECL extension instead of libxdiff).

Does anyone have any advice?

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Swiftheart
  • 443
  • 1
  • 5
  • 17

2 Answers2

2

OK, by virtue of this message I assume you are runnning the 32bit Wampserver. Thats ok, 32 code runs on a 64bit OS, but not the other way round.

PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.13/ext/php_xdiff.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0

So you will need to download the 32bit version of php_xdiff

Because of the way WampServer configures Apache & PHP you will need the Thread Safe dll i.e. download filename contains -ts- and not -nts-

As you are trying to add this to PHP5.3.x you will probably need the version compiled with VC9 unless PHP5.3.you_dont_specify is so old it is compiled with VC6 in which case I am not sure where you can get a version from. In that case you may be looking at upgrading you Apache and PHP version at least.

php_xdiff from here

pecl dependancies compiled libraries from here, like libxdiff

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • I'm using PHP 5.3.13. I tried both the thread-safe and non-thread safe dlls and received the same errors for both, unfortunately. Also, I'm still not sure what to do with the libxdiff library. I see the zip file contains bin, include and lib directories, but I don't see any corresponding directories in my WAMP folder. – Swiftheart Jun 06 '14 at 18:47
  • Try putting that in the Apachex.y.z folder. Not finding that will probably explain why the extension wont run. – RiggsFolly Jun 07 '14 at 15:29
  • 1
    Ah, okay. I didn't realize they went in the Apache folder. However, even after putting the PECL dependancies into the Apache folders, I'm still getting the "is not a valid Win32 application" error. Any more suggestions? :( – Swiftheart Jun 09 '14 at 19:14
0

Complementary to what RiggsFolly has already posted, which is correct, please keep in mind that you need to include xdiff in your php.ini file to be able to use xdiff* functions in Wamp.

This can be tricky, because there are actually two php.ini files in your wamp\bin\php directory. One is called php.ini and the other is called phpForApache.ini, and the active one is the one called phpForApache.ini (or at least that's how it is on my set-up)

To include the xdiff extension, you need to search the php.ini file for extension= and add the xdiff extension, like so:

PHP 7.1 or earlier

extension=... (other extensions)
extension=php_xdiff.dll

PHP 7.2+

extension=... (other extensions)
extension=xdiff
mavrosxristoforos
  • 3,573
  • 2
  • 25
  • 40