sqlsrv running on php 5.4 - php

I've just upgraded from PHP 5.3.10 to 5.4, now I get the following when trying to initialise php on the command line in windows:
C:\php5.4>php -v
PHP Warning: PHP Startup: sqlsrv: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
PHP 5.4.0 (cli) (built: Feb 29 2012 19:06:50)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
This should be a straight swap. I've downloaded the NTS version of php (same as 5.3.10 version) & referenced the php_sqlsrv_53_nts_vc9.dll (v2) of sqlsrv.
Out of interest I also have the sqlsrv v3.0 extension, which I tried to load in and get the same error.
Has anyone else had this issue, or know of how to fix it?
TIA
D

It looks like the version of the dll you have is for PHP 5.3
I'm not sure if there is a version out for 5.4 yet, but you can check the PHP Extensions for Windows page to see.
The system requirements page from Microsoft appears to indicate not (although it may not have been updated yet).

Only you need this link: https://www.microsoft.com/en-us/download/details.aspx?id=20098 the version 3.0
Regards

Related

PHP 7 C++ extension. The specified module could not be found

I wrote an extension with C++ for php on windows. I build multiple different versions:
php 5: with a MSVC11 compiler, linked with php5ts.lib, thread safe and it works fine
php 7: with a MSVC14 compiler, linked with php7ts.lib, thread safe, but it didn't work
The php 7 version gives me
Warning: PHP Startup: Unable to load dynamic library 'C:/openserver/ospanel/modules/php/PHP-7.0/ext/module_php_7.0.21_TS.dll' - The specified module could not be found.
in Unknown on line 0
PHP 7.0.21 (cli) (built: Jul 5 2017 13:31:19) ( ZTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
I tried to change extension folder, rename file, nothing helps. Library was built without any error. I double checked that it exists.
P.s: I know there is a difference between php5 and php7 api, i have #ifdef for this, so it's not a problem. Also we have successful build of this module with php7 on linux.
I resolved an issue. It was a mistake in build script. php5ts.lib and php7ts.lib was included at same time. I deleted php5ts.lib from linker and now it works as expected.

PHP Warning PHP Startup Unable to load dynamic library php_pdo_sqlsrv_7_ts_x64.dll

OS: Windows 8.1
Arch: x64
php: PHP 7.1.6
mssql: Mssql Server 2014 express
driver: SQLSRV 4.0
IDE: PhpStorm
I'm trying to get mssql drivers to work.
I downloaded the pdo driver from microsoft, put the file php_pdo_sqlsrv_7_nts_x64.dll into C:\Program Files\PHP\ext and edited php.ini to add extension=php_pdo_sqlsrv_7_nts_x64.dll to it.
This is the result:
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_sqlsrv_7_nts_x64.dll' - The specified procedure could not be found.
in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_sqlsrv_7_nts_x64.dll.dll' - The specified procedure could not be found.
in Unknown on line 0
PHP 7.1.6 (cli) (built: Jun 8 2017 01:53:41) ( ZTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Probable duplicate of this:
PHP Warning: PHP Startup: Unable to load dynamic library php_pdo_mssql.dll
But that one's never answered and four years old.
In my case, this error (but with a different DLL version) was caused by adding the wrong PHP SQL SLQSRV DLL to my PHP extensions:
I am using PHP 7.2.21 from XAMPP.
I added these DLLs (included in SQLSRV561.exe):
php_pdo_sqlsrv_72_ts_x64.dll
php_pdo_sqlsrv_72_ts_x86.dll
php_pdo_sqlsrv_72_nts_x64.dll
php_pdo_sqlsrv_72_nts_x86.dll
I enabled php_pdo_sqlsrv_72_nts_x64.dll as PHP extension, but the nts dll version was the wrong one for my PHP version. When I enabled the ts dll version, the error disappeared. ( I am using IIS.)
Thread Safe (TS) and Non-Thread Safe (NTS) are the two different PHP
builds available.
It's a good idea to look at the release information.
That way you can see what version it supports.
https://github.com/Microsoft/msphpsql/releases
In my case the mssql driver is still one minor version behind php's latest stable version, so I have to downgrade my php from 7.1 to 7.0.
Is your PHP version thread-safe? You are using the library for this version, you can use "php -i|find "Thread" from command line in windows.
I tried this using PHP732 on windows server 2019 with IIS10 using the php_pdo_sqlsrv_73_nts_x64.dll, works just fine without issue. It gives warning if I enable 73_ts_x64.

Build PHP with PHPfarm errors with loaders (ioncube and source guardian)

I can't configure ioncube or source guardian loaders with phpfarm. I thinks that is for "(DEBUG)" in php -v but I do not know how to. I need help with this issue.
My php -v:
root#martin:/opt/phpfarm/src# /opt/phpfarm/inst/php-5.3.22/bin/php -v
Cannot load the ionCube PHP Loader - it was built with configuration API220090626,NTS, whereas running engine is **API220090626,NTS,debug**
PHP Warning: PHP Startup: SourceGuardian: Unable to initialize module
Module compiled with build ID=API20090626,NTS
PHP compiled with build **ID=API20090626,NTS,debug**
These options need to match
in Unknown on line 0
Warning: PHP Startup: SourceGuardian: Unable to initialize module
Module compiled with build ID=API20090626,NTS
PHP compiled with build ID=API20090626,NTS,debug
These options need to match
in Unknown on line 0
PHP 5.3.22 (cli) (built: Apr 19 2015 17:43:14) **(DEBUG)**
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
Although I can only answer for the ionCube Loaders, I presume the same applies to the Source Guardian Loaders.
PHP extensions need to match the exact same version, including release/debug status, thread-safety and PHP version. You are therefore right in that the ionCube Loaders will not work on PHP compiled with debug symbols. ionCube does not provide Loaders for this scenario, so your only solution is to build PHP as release version.
Do note that building PHP with debug symbols will most likely not help you debug your PHP scripts, if that is your goal.

Setting Correct PATH for Homebrew PHP

I used Homebrew to install PHP versions 5.4 and 5.5 on my system. However, it seems that even after installing and linking to php55 my computer is still trying to run the version initially used by the system.
php --version
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_openssl.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_openssl.dll, 9): image not found in Unknown on line 0
PHP 5.3.26 (cli) (built: Jul 7 2013 19:05:08)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
I believe Homebrew sets up PHP under '/usr/local/lib' and not '/usr/lib/'.
What do I need to do to correctly have my system use the Homebrew version of PHP?
You have to put /usr/local/bin at the front of your $PATH. In your ~/.bashrc file, add something like
export PATH="$(brew --prefix)/bin:${PATH}"

PHP Apache ImageMagick extension won't load

I am runnning 64-bit Windows 7 with Apache 2.2, PHP 5.4.4 VC9. I have downloaded and installed ImageMagick 6.6.4 and successfully tested it from the command prompt. I have restarted my computer. I have tried many different extension files and keep getting the following error in my Apache logs.
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\PHP\\ext\\php_imagick_ts.dll' - The specified procedure could not be found.\r\n in Unknown on line 0
I have my extension_dir set to C:\PHP\ext. And I of course have added the line extension=php_imagick_ts.dll modified according to which file I am trying.
I have Imagick working on Win7 x64 with PHP 5.4 (only tested commandline, but Apache should work) using the beta libraries as compiled and hosted here: http://www.peewit.fr/imagick/
I installed ImageMagick via the ImageMagick-6.8.0-7-Q16-windows-dll.exe file on the ImageMagick downloads page.
C:\>php -v
PHP 5.4.0 (cli) (built: Feb 29 2012 19:24:02)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
C:\>php -m
[PHP Modules]
...
imagick
...
I haven't actually tested using this extension yet, but I'm fairly confident that this will work, given that all of the other .dlls I tried resulted in php.exe crashing when I tried simply running php -v!
The only thing that ended up working for me was to load php 5.3. Began working immediately.

Categories