1

I am trying to connect remote Microsoft SQL server using PDO. Before installing required drivers (SQLSRV30) my phpinfo()'s configure command section shows-

cscript /nologo configure.js "--enable-snapshot-build" "--without-dblib" "--without-pdo-dblib" "--without-pdo-mssql" "--with-pdo-oci=C:\php-

I have installed required drivers->php_pdo_sqlsrv_54_ts.dll and php_sqlsrv_54_ts.dll (I am using PHP 5.4 using APACHE server). I have also made required changes in php.ini file-

extension=php_pdo_sqlsrv_54_ts.dll
extension=php_sqlsrv_54_ts.dll

Despite this, when I tried making connection with MSSQL Server, error appears saying undefined function mssql_connect() and undefined function sqlsrv_connect().

The php info page still says that-> "--without-pdo-mssql" in configure command section.

Kindly help where the problem is!

PS:1) When using ODBC odbc_connect() function works fine. 2) I have refreshed Apache several times after editing. 3) I have saved .ts files in the C:\wamp\bin\php\php5.4.12\ext folder

13
  • Does the sqlsrv section appear in the output of phpinfo() after restarting the apache? If not check whether you've edited the correct php.ini (the path is also included in the output of phpinfo()) and check the php log file for startup errors. Commented Jul 9, 2015 at 9:01
  • @VolkerK No, sqlsrv section does not appears in phpinfo(). I have checked the php.ini file mentioned in phpinfo(); It is the same file that I had edited. Also the error_log says no value for local and master value. Commented Jul 9, 2015 at 9:10
  • then set a value for error_log in the php.ini and try again. e.g. error_log=c:/temp/php_errors.log or some other valid file path. After restarting the apache check the contents of that file. Commented Jul 9, 2015 at 9:12
  • @VolkerK in addition to sqlsrv_pdo I had also saved php_pdo_mssql. could by any change they can conflict? Commented Jul 9, 2015 at 9:12
  • sqlsrv_pdo& php_pdo_mssql "could by any change they can conflict?" - no idea but I doubt it. Commented Jul 9, 2015 at 9:13

1 Answer 1

1

The php_sqlsrv_5x_ts.dlls provided by Microsoft are 32bit. They won't work for a 64bit build of php.
The source code is available at https://github.com/azure/msphpsql, so you might be able to compile a 64bit version yourself - if necessary.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.