PHP5.4 and SQLSRV problem
-
Tuesday, March 27, 2012 9:36 AM
hi there,
I've done the necessary installation using the recently updated sql server 3.0. However, I am still not getting sqlsrv in my registered stream. May i know the problem?
I am using php 5.4 and Apache 2.2 as my webserver. I've restarted my webserver everytime i edited the php.ini to no avail. I have pointed to the extension explicitly in the .ini file as well.
Please get back to me soon as i am working on a school project!
Much thanks!
All Replies
-
Tuesday, March 27, 2012 11:28 AMWe need a bit more information to help. Can you run phpinfo() and post the first 2 main sections here (up to and including Apache Handler) ?
Rob
-
Tuesday, March 27, 2012 11:34 AM
PHP Version 5.4.0
System Windows NT TAIYUN-PC 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) i586 Build Date Feb 29 2012 19:20:16 Compiler MSVC9 (Visual C++ 2008) Architecture x86 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo" Server API Apache 2.0 Handler Virtual Directory Support enabled Configuration File (php.ini) Path C:\Windows Loaded Configuration File D:\Webserver\php\php.ini Scan this dir for additional .ini files (none) Additional .ini files parsed (none) PHP API 20100412 PHP Extension 20100525 Zend Extension 220100525 Zend Extension Build API220100525,TS,VC9 PHP Extension Build API20100525,TS,VC9 Debug Build no Thread Safety enabled Zend Signal Handling disabled Zend Memory Manager enabled Zend Multibyte Support disabled IPv6 Support enabled DTrace Support disabled Registered PHP Streams php, file, glob, data, http, ftp, zip, compress.zlib, phar Registered Stream Socket Transports tcp, udp Registered Stream Filters convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*
This program makes use of the Zend Scripting Language Engine:
PHP Credits
Configuration
apache2handler
Apache Version Apache/2.2.22 (Win32) PHP/5.4.0 Apache API Version 20051115 Server Administrator ty_lee@live.com.sg Hostname:Port TaiYun-PC.gateway.2wire.net:0 Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts Connection: 300 - Keep-Alive: 5 Virtual Server No Server Root D:/Webserver Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_php5 mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif
Directive Local Value Master Value engine 1 1 last_modified 0 0 xbithack 0 0 -
Tuesday, March 27, 2012 11:47 AM
The extensions you need are from SQLSRV30.exe (from here: http://www.microsoft.com/download/en/details.aspx?id=20098):
- extension=php_sqlsrv_54_ts.dll
- extension=php_pdo_sqlsrv_54_ts.dll
You also must install the SQL Server 2012 Native Client x64 version from here (search the page): http://www.microsoft.com/download/en/details.aspx?id=29065
You must also ensure that your Apache is built on VC9. I can't tell from your PHP Info whether it is VC9 or not, and I assume it is... but if not, here's the link: http://apachelounge.com/
Rob
-
Tuesday, March 27, 2012 11:59 AM
I have already done the steps that you previously mentioned. Restarted my webserver and ran phpinfo again.. Registered Streams still does not contain sqlsrv
PHP Version 5.4.0
System Windows NT TAIYUN-PC 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) i586 Build Date Feb 29 2012 19:20:16 Compiler MSVC9 (Visual C++ 2008) Architecture x86 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo" Server API Apache 2.0 Handler Virtual Directory Support enabled Configuration File (php.ini) Path C:\Windows Loaded Configuration File D:\Webserver\php\php.ini Scan this dir for additional .ini files (none) Additional .ini files parsed (none) PHP API 20100412 PHP Extension 20100525 Zend Extension 220100525 Zend Extension Build API220100525,TS,VC9 PHP Extension Build API20100525,TS,VC9 Debug Build no Thread Safety enabled Zend Signal Handling disabled Zend Memory Manager enabled Zend Multibyte Support disabled IPv6 Support enabled DTrace Support disabled Registered PHP Streams php, file, glob, data, http, ftp, zip, compress.zlib, phar Registered Stream Socket Transports tcp, udp Registered Stream Filters convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*
This program makes use of the Zend Scripting Language Engine:
PHP Credits
Configuration
apache2handler
Apache Version Apache/2.2.22 (Win32) PHP/5.4.0 Apache API Version 20051115 Server Administrator ty_lee@live.com.sg Hostname:Port TaiYun-PC.gateway.2wire.net:0 Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts Connection: 300 - Keep-Alive: 5 Virtual Server No Server Root D:/Webserver Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_php5 mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif
Directive Local Value Master Value engine 1 1 last_modified 0 0 xbithack 0 0
Apache Environment
Variable Value HTTP_HOST localhost HTTP_USER_AGENT Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0 HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_LANGUAGE en-gb,en;q=0.5 HTTP_ACCEPT_ENCODING gzip, deflate HTTP_CONNECTION keep-alive HTTP_COOKIE PHPSESSID=54btgcb29vdpnrrm0pa97hfq24 PATH C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\QuickTime\QTSystem\;D:\Programs\FlashDevelop\android-sdk-windows\platform-tools;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Java\jdk1.7.0\bin;D:\Programs\MATlab 2011\runtime\win64;D:\Programs\MATlab 2011\bin;D:\Webserver\php; SystemRoot C:\Windows COMSPEC C:\Windows\system32\cmd.exe PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC WINDIR C:\Windows SERVER_SIGNATURE no value SERVER_SOFTWARE Apache/2.2.22 (Win32) PHP/5.4.0 SERVER_NAME localhost SERVER_ADDR 127.0.0.1 SERVER_PORT 80 REMOTE_ADDR 127.0.0.1 DOCUMENT_ROOT D:/Webserver/htdocs SERVER_ADMIN ty_lee@live.com.sg SCRIPT_FILENAME D:/Webserver/htdocs/hello.php REMOTE_PORT 51613 GATEWAY_INTERFACE CGI/1.1 SERVER_PROTOCOL HTTP/1.1 REQUEST_METHOD GET QUERY_STRING no value REQUEST_URI /hello.php SCRIPT_NAME /hello.php - Edited by hefirius Tuesday, March 27, 2012 12:00 PM
-
Tuesday, March 27, 2012 12:23 PMI solved it.. thank you so much
-
Tuesday, March 27, 2012 12:38 PM
Great. Could you post your solution and mark it as the answer? It will help other people.Rob
- Proposed As Answer by Jonathan GuerinMicrosoft Employee Wednesday, March 28, 2012 5:09 PM
- Marked As Answer by Jonathan GuerinMicrosoft Employee Tuesday, April 03, 2012 5:38 PM
-
Wednesday, March 28, 2012 5:10 PM
Hi Hefirius,
It would be great if you could please post your solution!
Thanks,
Jonathan
This posting is provided 'AS IS' with no warranties, and confers no rights.
-
Monday, July 16, 2012 11:58 AM
Hi,
Could you please post your solution? I am facing the same issue.
Thanks in advance.
-
Monday, July 16, 2012 1:48 PM
Hi ItsPunit
Please can you post the following information:
- Your version of Windows where PHP is running, and whether it's a 32 or 64 bit version.
- Your web server type (e.g. IIS or Apache), and your web server version and build (e.g. if Apache, is it built with VC9?)
- Your SQL Server version
- Your PHP version and build information (e.g. PHP 5.4 NTS VC9 32 bit)
Many thanks - we should be able to help.
Rob
-
Monday, October 01, 2012 2:40 PM
Hi Robert,
I have the same problem of hefirius
Windows 7 Home Premium x64
Apache 2.4.2 x64
PHP 5.4.3 TS VC9
Native Client 2012I have included the files in the folder and "php.ini"
But phpinfo() not show sqlsrv ext
Sorry for my bad english, i'm Brazilian
-
Monday, October 01, 2012 4:58 PM
Hi Daniel
You have 64-bit PHP installed, which will not be able to load the SQLSRV extension, which is built as 32-bit.
You must do at least *one* of these options:
- Install everything in 32-bit
- Find a 64-bit build of Microsoft's SQLSRV driver.
- Get a 32-bit Non-Thread-Safe version of PHP, and use Apache's mod_fcgid (FastCGI on Apache):
https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html. I have never tried this configuration myself, but I don't see any reason for it not to work.
Rob
- Proposed As Answer by Daniel Gimenes Tuesday, October 02, 2012 3:54 PM
- Marked As Answer by Jonathan GuerinMicrosoft Employee Tuesday, October 02, 2012 5:52 PM
-
Monday, October 01, 2012 6:03 PMThanks, I installed Wamp x32 and everything worked beautiful. Problem solved :)
- Edited by Daniel Gimenes Monday, October 01, 2012 6:54 PM
-
Thursday, November 15, 2012 2:51 PM
I'm having the exact same issue and very curious what the fix was.
Windows Server 2008 R2 SP1 64bit
PHP 5.4.0 x86
Apache 2.2.22
Microsoft SQL Server 2012 Native Client
Microsoft SQL Server 2008 R2 Connectivity
Currently enabled in php.ini:
extension=php_sqlsrv_54_nts.dll
extension=php_pdo_sqlsrv_54_nts.dll
I've tried all sorts of combinations of enabling the sqlsrv extensions to no avail. The Thread-Safe extensions kill the server when enabled so I'm assuming non thread-safe is the way I need to go. Unfortunately sqlsrv won't show up in the phpinfo stream.
PHP_Errors.Log: PHP Warning: PHP Startup: Unable to load dynamic library 'f:\apps\php\ext\php_sqlsrv_54_nts.dll' - The specified module could not be found.
Same for the pdo dll as well.
Any help would be greatly appreciated!
- Edited by The Doop Thursday, November 15, 2012 4:02 PM Added log entry.
-
Thursday, November 15, 2012 8:55 PMAfter troubleshooting throughout the day I was able to finally get SQLSRV to show up in the phpinfo stream. I kind of attacked the issue with force after I had tried everything I could think of. I repaired the SQL Server 2012 Native Client, redownloaded the dlls and used the Thread-Safe dlls that previously killed PHP. I'm thinking that the dlls were corrupt, but I can't say for sure since I just smacked it with a big hammer. Anyways, glad it's working and time to code!

