Installing PHP xdiff on Windows with WAMP - php

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?

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

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

Related

PHP, Apache: Unable to load dynamic library (even if there is one)

Today I have migrated my XAMPP's internals to 64bit:
Apache (from 32bit 2.4.25 to 64bit 2.4.27)
PHP (from 32bit 7.1.4 to 64bit 7.1.9)
I have downloaded each extension used before in 32bit, installed, configured (copy&paste mostly with path changes if needed) and generally everything "works".
-> % php --version
PHP 7.1.9 (cli) (built: Aug 30 2017 18:34:46) ( ZTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
But somehow I get PHP Startup: Unable to load dynamic library errors even if there are valid DLLs (most of them bundled in downloaded PHP package). These are curl, intl, ldap and imagick (the last one is installed by me). Paths are correct in php.ini (many other extensions are loaded properly from the same directory). This is what I get in php_error_log every time when I access page through Apache:
[22-Sep-2017 15:52:47 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Bin\XAMPP\7.0.9\php\ext\php_curl.dll' - The specified module could not be found.
in Unknown on line 0
[22-Sep-2017 15:52:47 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Bin\XAMPP\7.0.9\php\ext\php_intl.dll' - The specified module could not be found.
in Unknown on line 0
[22-Sep-2017 15:52:47 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Bin\XAMPP\7.0.9\php\ext\php_ldap.dll' - The specified module could not be found.
in Unknown on line 0
[22-Sep-2017 15:52:47 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Bin\XAMPP\7.0.9\php\ext\php_imagick.dll' - The specified module could not be found.
in Unknown on line 0
In CLI everything is fine (it's the same php.ini as for Apache):
-> % php -i | grep -n3 curl
175:curl
178-cURL Information => 7.55.0
-> % php -i | grep -n3 ldap
347:ldap
349-LDAP Support => enabled
350-RCS Version => $Id: 0779387e5f88edc656159d12b9302a053e82cc79 $
-> % php -i | grep -n3 intl
330:intl
332-Internationalization support => enabled
333-version => 1.1.0
335-ICU Data version => 57.1
but in Apache I have Attempted to call function "curl_init" ... error :(
Any ideas?
I had the same problem on Windows 10 and solved it by adding the php home directory to the system (NOT user!) PATH environment and rebooting the system.
When Apache is installed as a service it is run as a system user which means it does not see your user environment variables.
it's basically 404'ing the dll's. either the user that apache runs as, doesn't have permissions to read the folder D:\Bin\XAMPP\7.0.9\php\ext\ , or the folder doesn't exist. as for why it works in cli but not in apache, they're probably reading different php.ini's , but it could also be that php-cli runs as a different user account. to check that, run php -r 'phpinfo();' | grep -i username in cli, and a page with <?php phpinfo(); and look for "Enviorment" > "User" in apache phpinfo(); , the pages will also tell you if they're loading the same php.ini file.
and nothing of this has anything to do with programming, so i say again, this should be on serverfault.com or something, not stackoverflow.com
Check if your DLL's are in proper version. There is quite often difference between x64 and x86 version, also between ZTS and NON TREAD SAFE. For some reason instead of nice error message of ddls being incompatible you will only get information: cannot load extension.
Well, this is weird but the root problem of this issue was... using Apache as service. I can't explain why, but when running Apache as service these extensions could not be loaded, but when running without service, using only "Start" from XAMPP control center, all is working fine with the same config and directory/file structure.
I realized that when I wanted to back to my previous working versions and I linked 32bit versions again (I use apache and php symlinks in XAMPP installation dir). cURL was not loaded, but it was working before migrating to 64bit. So I started digging and experiment with service and after unregistering it started working correctly. So I thought it could be the case with 64bit too... And it was.
Now I can start Apache properly. There is still minor issue because XAMPP control panel doesn't show Apache as running after clicking "Start", but processes are there and is working. But most important is everything is OK under the hood.
I had the same problem. All extensions loaded except these two: amqp and pdo_sqlite:
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: D:\\xampp74\\php\\ext\\pdo_sqlite (The specified module could not be found.), D:\\xampp74\\php\\ext\\php_pdo_sqlite.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'amqp' (tried: D:\\xampp74\\php\\ext\\amqp (The specified module could not be found.), D:\\xampp74\\php\\ext\\php_amqp.dll (The specified module could not be found.)) in Unknown on line 0
One solution is so add the php path to your environmental variable PATH.
The real problem here is that although extension dlls live in xampp\php\ext, some extensions have additional files that are located in xampp\php. These additional dlls are the ones that can not be loaded if the php path is not added to your PATH.
If you do not want to add the PHP path to your PATH, the solution is to add the extra dll files to the xampp\apache\bin folder (copy, not move). In my case:
libsqlite3.dll for pdo_sqlite
rabbitmq.4.dll and rabbitmq.4.pdb for php_amqp
Or, if you start apache via a batch file, add the php path before starting apache:
SET PATH=%PATH%;d:\xampp74\php

sql server 2014 and xamp php 7.0

I have updated four files names given below in php/ext folder of xampp
I also updated these updated lines in php.ini
extension=php_pdo_sqlsrv_7_nts_x64.dll
extension=php_pdo_sqlsrv_7_ts_x64.dll
extension=php_sqlsrv_7_nts_x64.dll
extension=php_sqlsrv_7_ts_x64.dll
but when I try to run php artisan migrate it gives me this error
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\xampp\php\ext\php_pdo_sqlsrv_7_nts_x64.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
what could be the possible problem?
Am I doing something wrong
I downloaded files from https://www.microsoft.com/en-us/download/details.aspx?id=20098
Actually I came to knew that x64 or x86 is version of php which can be obtained from phpinfo(). so my php was x86 and I was using x64 files and also my php was thread enables so I did not need nts files

PHP SQL connectivity

I have manually installed Apache and PHP on my server and it has to connect to the sql server 2012 for DB. My configurations are as below:
Apache 2.4.23 VC11 x64 installed on E:\
PHP 7.0.12 VC14 x64 installed on e:\
I have installed the srv dlls from the microsoft website.( SQLSRV40.exe). Also I have installed the msodbcsql dll and the sql native client (both 64bit) , but while I run these two .exe it gets installed on to the default path which is c:\
I have enabled the php_errors and I could see that php is working fine with the phpinfo() but on the phpinfo() i dont see the sql.dll files being picked up. More over the php_error file throws the error:
"[01-Nov-2016 12:14:58 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'E:/php/ext/php_sqlsrv_7_ts_x64.dll' - The specified module could not be found.
in Unknown on line 0
[01-Nov-2016 12:14:59 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'E:/php/ext/php_sqlsrv_7_ts_x64.dll' - The specified module could not be found.
in Unknown on line 0"
Am not able to figure out what went wrong, Could some one help me out, please
You can simply move the .dll files from C:\ to E:\php\ext\ (copy & paste).
Alternatively you can alter the path in the php.ini file which should also be in E:\php.
It might be helpful if you search for all files containing the text php_sqlsrv_7_ts_x64 then you know where they are actually loaded.

Apache2.2 - PHP5.3 - MySQL5.5 - MantisBT

Having a little trouble here with Apache 2.2 & PHP 5.3 & MySQL 5.5, seems PHP sees the MySQL module, the relevant parts have been added or un-commented and the DLL file does exists in the c:\php\ folder, but when I go to set up Mantis and run the setup, I get the below error.
Any obvious issues people have experienced with this?
If need be I can add my php.ini or httpd.conf, but I don't see any more config to be added to them than I have shown in the attachment below.
Cheers in advance
KS
This should trow a little more light on the subject (from the Apache error.log):-
PHP Warning: PHP Startup: mysql: Unable to initialize module\nModule
compiled with build ID=API20090626,NTS,VC9\nPHP compiled with build
ID=API20090626,TS,VC9\nThese options need to match\n in Unknown on
line 0 PHP Warning: PHP Startup: mysqli: Unable to initialize
module\nModule compiled with build ID=API20090626,NTS,VC9\nPHP
compiled with build ID=API20090626,TS,VC9\nThese options need to
match\n in Unknown on line 0 [Wed Apr 24 11:07:21 2013] [notice]
Apache/2.2.22 (Win32) PHP/5.3.23 configured -- resuming normal
operations ...
I'm using:
PHP v5.3.23
Apche v2.2.22
MySQL v5.5.30
SORTED!
Not sure how or why, but when I first installed PHP I used this php-5.3.23-nts-Win32-VC9-x86.msi installer and was getting the above error. I downloaded this zip php-5.3.23-Win32-VC9-x86.zip and used the mysql.dll and mysqli.dll from the zips /ext folder and replaced the DLLs in the installed c:\php\ext folder. Then restarted Apache and - bingo! worked!
The sizes and dates of the DLLs from the zip are slightly different tothe ones in the MSI install, so there must be a slight variation.
Phew - and they say PHP is simple to use, give my JSP pages any day!

PHP Startup: Unable to load dynamic library

I am trying to use Firebird 2.5.2.26539 with:
Windows 8
Apache 2.2.22
PHP 5.4.10
When i enable the extensions of firebird in php:
- extension=php_interbase.dll
- extension=php_pdo_firebird.dll
I get these errors:
[26-Dec-2012 12:08:11 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_interbase.dll' - Impossible to locate the specified module.
in Unknown on line 0
[26-Dec-2012 12:08:13 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_pdo_firebird.dll' - Impossible to locate the specified module.
in Unknown on line 0
if i make PHP -a in command line, the error message is different: cannot find fbclient.dll.
I have the flamerobin running and it opens the database. So i copy the fbclient.dll to the PHP root path.
Then the errors change to:
[26-Dec-2012 11:55:46 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_interbase.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
[26-Dec-2012 11:55:46 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_pdo_firebird.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
Can anyone help me on this one? I suspect that this version of Firebird still does not have the correct extensions made for the PHP.
Thank you.
I am repeating the comment (which some might miss) by Nenhum Pois é above, because it is the real solution to the problem:
The problem was the fbclient.dll from the FB 64 bits installation. I just got the fbclient.dll from 32bits, copy it into the PHP root and it solved the problem
Cli and Apache PHP run with two different configuration files. That will explain the lacking error message in CLI mode. The likelihood is the extensions for this application where not stored in the PHP extension folder. I'm not versed with the configurations under windows so you may need to google for the Windows PHP extension directory and ensure your extension file is there.
Judging by your error the path is "C:\Program files(x86)\PHP\ext\
Please ensure your extension files are there before attempting to load them.
If you run on Windows check if your extension is compiled with the same Visual Studio compiler version as your PHP interpreter.
From PHP download page https://windows.php.net/download
PHP 7.3 = VC15
PHP 7.1 = VC14
PHP 5.6 = VC11
Whereas the MongoDB extension for examples is compiled with VC11, see https://pecl.php.net/package/mongo/1.6.16/windows and check the DLL list filename for -vc11-

Categories