Mismatch between Php and Extension module - php

I am trying to install the following php extension. Microsoft Drivers for SQL Server for PHP.
I have tried both versions of the driver but both seem to mismatch the version of php i am running. I looked around and it appears I have to recompile the modules in order to match the php api version. But I don't have any idea how to do this.
Any ideas on how to make this work? Or maybe a simpler way to use PHP 5.4.7 to access SQL.

You can do it with some tricks, its not recommended but it will work fine and in my case, it has not crashed yet :)
Check your phpinfo() page for:
1-PHP extension API Number
2-Thread safe or non-thread safe version
3-(Windows) compiler version
1-For building your extension you need php.lib. It is in your PHP-server dev directory.
2-You need PHP header files for compiling your extension, after including PHP header files, go to PHP/Zend directory and open zend_modules.h file and change the #define ZEND_MODULE_API_NO 20060613to your PHP extension API number for example change it to #define ZEND_MODULE_API_NO 20090626.
3- If you use windows based servers the compiler version is important(VC8 - VC10), if your PHP was compiled with VC8, build the extension in VS2008 or use VC8 for building your project.
If you encounter any wired error just comment it. I spent 3 months to make this worked ;)

Related

The procedure entry point _zend_hash_index_update##24 could not be located in the dynamic link library

When I start XAMPP it gives me the following error when trying to load the SQL Server driver for PHP.
The procedure entry point _zend_hash_index_update##24 could not be located in the dynamic link library D:\xampp\php\ext\php_sqlsrv_72_ts_x64.dll.
I have tried downloading both the Microsoft SQL Server Driver 4.0 and 5.6 for php and use the php_sqlsrv_7_ts_x64.dll and php_sqlsrv_72_ts_x64.dll in the extension directory and add them to php.ini.
I found this posting related to this error:
PHP 7 on IIS: Call_user_function could not be located
In the system requirements, for MSSQL driver 4.0 it states that this driver is good for PHP 7.0+. In trying 5.6, I found this posting saying that it's support for PHP 7.3:
https://blogs.msdn.microsoft.com/sqlphp/2019/03/01/drivers-5-6-for-php-for-sql-server-released/
Either way, I still receive the same error. Is there something else I need to be checking?
In short go to https://learn.microsoft.com/en-us/sql/connect/php/microsoft-php-drivers-for-sql-server-support-matrix?view=sql-server-2017#php-version-support.
Then compare your php version against driver version in a table displayed.
Finally download a correct version, that is all.
use the 7.3 one instead (php_sqlsrv_73_...)
I was receiving this error also, trying to load php_sqlsrv_7_nts_x86 for php-7.3.8-nts-Win32-VC15-x86.
If you look at this support matrix on the microsoft site you'll see plenty of other options for drivers that support your PHP version.
I downloaded the latest, the SQLSRV561 package. That did the trick.
So Just to be clear,
I loaded php_sqlsrv_73_nts_x86.dll (from SQLSRV5.6.EXE) instead of php_sqlsrv_7_nts_x86 (from SQLSRV4.0.EXE), and that fixed the problem.

PHP install mailparser extension

I want to install mailparser extension.
I downloaded php_malparse.dll ( put it to php/ext folder).
Also added : extension=php_mailparse.dll to php.ini
But it doesn't work, and php_info() doesn't show it too.
In logs I get:
PHP Warning: PHP Startup: Unable to load dynamic library 'E:\xampp\php\ext\php_mailparse.dll' - %1 \xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd‌​\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd‌​\xef\xbf\xbd\xef\xbf‌​\xbd\xef\xbf\xbd\xef‌​\xbf\xbd\xef\xbf\xbd‌​\xef\xbf\xbd Win32.\r\n in Unknown on line 0
I need help, how can I solve this problem?
Thanks!
It's difficult to say what's going on here. Typically the message Unable to load dynamic library means the library (in this case on Windows the .dll file) is not correctly formatted and the OS was unable to map it into memory or PHP was not able to use it.
Some possible reasons include:
The extension was not compiled for the same architecture as the target PHP build (e.g. the PHP is x86-64 but the library is x86)
The extension was not compiled using the same runtime version; PHP is pretty strict about this (e.g. PHP5 is built with vc11 on Windows, PHP7 is built with vc14, ETC.)
The extension was not compiled against the same version of the PHP API or extension API used by your PHP build; typically PHP will show a more-detailed error message when this is the case (it's strange that your error message contains a bunch of non-printing characters though...)
To double-check all this, view a dump of phpinfo() to see what kind of PHP you have. Look for the PHP API and extension versions as well as the system architecture and whether thread safety is enabled. Then return to where you downloaded the php_mailparse.dll extension library and make sure the extension aligns with your PHP build. Here are some official instructions for this process for Windows PHP extensions.
I found official builds of this module here. There are a lot of different choices to pick from. Pay attention to ts (i.e. Thread-safe) vs nts (i.e. Non-thread-safe), x86 vs x64 (i.e. the architecture) and vc11 vs vc14 (i.e. the runtime version). You may have to experiment until you find one that works for your PHP build.
It might also be worth checking out the official install instructions for the mailparse extension. Note especially that the mbstring module has to be loaded first for it to work.

How does one build WINCACHE .DLL from source files?

I downloaded WINCACHE-1.3.7.4.tgz from the PECL download page. Unpacking it i find many a C orientated source file. Compiling from source in Linux i have some experience in BUT none at all in Windows (i am running Windows 7).
The instructions on PHP.net's WinCache pages does not seem to match the files extracted from the `.tgz'
I have looked at suggested questions
Creating Windows DLL from C++ source files
Creating php DLL from pecl source files
but i have NO idea where to actually start off.
And thus, does anyone know how i would build WinCache .DLL from the provided source? (if at all easily possible)
Do you really need to build this extension from source? If not, you can download precompiled DLLs here. If yes, you have to follow this tutorial for compiling PHP extension on Windows. Basically, you have to build PHP and it will also compile extension that you will enable. After successful compilation you should be able to find required dll and use it with your running PHP.
But another question is for what do you need it? What version of PHP do you use? If 5.5+ you should consider OPCache instead WinCache.
Since the Zend Opcache extension is now in the core PHP product, the WinCache opcode cache is disabled by default. As of PHP 5.5, the opcode cache portion of WinCache is deprecated, and will be removed in a future release of the WinCache extension.

PHP 5.3: how to add PDFlib?

I recently upgraded my Linux server from Apache 2.1 to 2.4 and PHP 5.2 to 5.3. Previously I was using pdf.so from PDFlib fine, but when I tried to install it, as downloaded from here,
http://www.pdflib.com/download/free-software/pdflib-lite-7/
PHP failed to load the module as it was compiled in for PHP 5.3. This install was done using the newest version of PDFlib that I could find, 9.0.2.
Anyone know whether this is possible? I've already got things coded in PHP for PDFlib and prefer not to use another library unless the commands are the same.
UPDATE
Has anyone successfully used PDF Lite with PHP 5.3?
You must compile it. Currently no build is available for PHP 5.3.
On the Download-Site, READ the info:
PDFlib Lite source code must be compiled to generate a usable library. PDFlib GmbH does not offer precompiled (binary) versions of PDFlib Lite.
If you have compile errors, check out the error logs - What say it? Yep, i think you need additional sources for compiling (mostly).

Cannot find php_sqlsrv extension - 5.3, threadsafe

I've followed the answer to this question to the letter:
Connection between MSSQL and PHP 5.3.5 on IIS is not working
I'm using XAMPP with threadsafe 5.3. I've copied the files to the extension directory (while leaving them in the /php folder) and I've added the extension lines:
extension=php_sqlsrv_53_ts.dll
extension=php_pdo_sqlsrv_53_ts.dll
When I do this, Apache fails to start, giving me errors in eventvwr like:
Application popup: Warning : PHP Startup: Unable to load dynamic library
'C:\xampp\php\ext\php_sqlsrv_53_ts.dll'
- The specified module could not be found.
Except, obviously, that that file DOES exist in that spot, and php.ini is pointed at that extension directory.
What's the problem?
Windows reports this when a shared lib dependency of what you're loading is missing. Use depends.exe to view the dependencies of php_sqlsrv_53_ts.dll and make sure it's either previously loaded or in the shared library search path.
http://www.dependencywalker.com/
See below url
php_sqlsrv.dll: gives error when checking PHP version but extension works
Read it:-
Since PHP 5.3, Microsoft has a new driver for windows :
http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx
Maybe you can try this version, which seems quite recent (06/2011)
Hope that helps !
Sadly, none of the answers addressed the issue or were avenues I had already explored.
I have decided to use the ODBC drivers with a SQL Server connection string, which seems to work fine, minus the fact I can't use MSSQL and SQLSRV native functions.
I have written a page that might help when installing the SQLSRV driver:
http://robsphp.blogspot.co.uk/2012/09/how-to-install-microsofts-sql-server.html
Unfortunately the instructions got complicated when MSFT removed the download for the old XP/2003 driver (version 2.0), so read the whole page before starting.
Wrong technology, but I was having problems getting WAMP to connect to MSSQL, with the same types of errors.
I fixed the problem by installing the 32-bit version of WAMP (instead of 64, even though we were on a 64-bit system).
Even if that's not applicable to the OP, I hope someone finds this helpful!
I was getting the same error messages when I started the Drupal 7 stack after installation. I am using VM Ware with Win 7 x64 and acquia-drupal-win-7.31.36-6159.54300.
I went to the PHP site http://php.net/manual/en/sqlsrv.requirements.php and installed the x64 Package.
steps
1) Stop Drupal Stack
2) run the file: sqlncli.msi
3) restart Drupal, and no error messages.

Categories