简体   繁体   中英

Installing PHP xdiff on Windows with WAMP

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
: 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.:PHP 启动:无法加载动态库“c:/wamp/bin/php/php5.3.13/ext/php_xdiff.dll” - %1 不是有效的 Win32 应用程序。

in on line 的第

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
: 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.:PHP 启动:无法加载动态库 'c:/wamp/bin/php/php5.3.13/ext/php_xdiff.dll' - 找不到指定的模块。

in on line 的第

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?

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 ie 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM