Merge pull request #386 from yitam/sqlpassword
Fixed Authentication=SqlPassword issue on Appveyor by overwriting the existing ODBC driver that comes with the VMs
This commit is contained in:
commit
99389538d2
11
appveyor.yml
11
appveyor.yml
|
@ -56,7 +56,6 @@ environment:
|
||||||
PHP_INSTALL_DIR: c:\projects\php\x86\bin
|
PHP_INSTALL_DIR: c:\projects\php\x86\bin
|
||||||
PHP_ZTS: --disable-zts
|
PHP_ZTS: --disable-zts
|
||||||
platform: x86
|
platform: x86
|
||||||
|
|
||||||
|
|
||||||
# PHP_MAJOR_VER is PHP major version to build (7.0, 7.1)
|
# PHP_MAJOR_VER is PHP major version to build (7.0, 7.1)
|
||||||
# PHP_MINOR_VER is PHP point release number (or latest for latest release)
|
# PHP_MINOR_VER is PHP point release number (or latest for latest release)
|
||||||
|
@ -112,11 +111,13 @@ install:
|
||||||
- move php-sdk-binary-tools-20110915.zip ..
|
- move php-sdk-binary-tools-20110915.zip ..
|
||||||
- echo Downloading PHP source code [%PHP_VERSION%]
|
- echo Downloading PHP source code [%PHP_VERSION%]
|
||||||
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/releases/php-' + ${env:PHP_VERSION} + '-src.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\..\php.zip')
|
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/releases/php-' + ${env:PHP_VERSION} + '-src.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\..\php.zip')
|
||||||
#- echo Downloading PHP deps [%PHP_DEPSVER%]
|
|
||||||
#- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/php-sdk/deps-' + ${env:PHP_DEPSVER} + '-vc' + ${env:PHP_VC} + '-' + ${env:BUILD_PLATFORM} + '.7z', ${env:APPVEYOR_BUILD_FOLDER} + '\..\deps.7z')
|
|
||||||
- echo Downloading MSODBCSQL 13.1
|
- echo Downloading MSODBCSQL 13.1
|
||||||
- ps: (new-object net.webclient).DownloadFile('https://download.microsoft.com/download/D/5/E/D5EEF288-A277-45C8-855B-8E2CB7E25B96/' + ${env:BUILD_PLATFORM} + '/msodbcsql.msi', 'msodbcsql.msi')
|
# AppVeyor build works are x64 VMs and 32-bit ODBC driver cannot be installed on it
|
||||||
- ps: msiexec /i msodbcsql.msi /quiet /qn
|
- ps: (new-object net.webclient).DownloadFile('https://download.microsoft.com/download/D/5/E/D5EEF288-A277-45C8-855B-8E2CB7E25B96/x64/msodbcsql.msi', 'c:\projects\msodbcsql.msi')
|
||||||
|
- cmd /c start /wait msiexec /i "c:\projects\msodbcsql.msi" /q
|
||||||
|
- echo Checking the version of MSODBCSQL
|
||||||
|
- reg query "HKLM\SOFTWARE\ODBC\odbcinst.ini\ODBC Driver 13 for SQL Server"
|
||||||
|
- dir C:\Windows\System32\msodbcsql13.dll
|
||||||
- cd ..
|
- cd ..
|
||||||
- cd
|
- cd
|
||||||
- 7z x -y php-sdk-binary-tools-20110915.zip -o%PHP_SDK%
|
- 7z x -y php-sdk-binary-tools-20110915.zip -o%PHP_SDK%
|
||||||
|
|
|
@ -4,13 +4,13 @@ Test the Authentication keyword with options SqlPassword and ActiveDirectoryInte
|
||||||
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("autonomous_setup.php");
|
require_once("MsSetup.inc");
|
||||||
|
|
||||||
$connectionInfo = " Authentication = SqlPassword; TrustServerCertificate = true;";
|
$connectionInfo = "Database = $databaseName; Authentication = SqlPassword; TrustServerCertificate = true;";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$conn = new PDO( "sqlsrv:server = $serverName ; $connectionInfo", $username, $password );
|
$conn = new PDO( "sqlsrv:server = $server ; $connectionInfo", $uid, $pwd );
|
||||||
echo "Connected successfully with Authentication=SqlPassword.\n";
|
echo "Connected successfully with Authentication=SqlPassword.\n";
|
||||||
}
|
}
|
||||||
catch( PDOException $e )
|
catch( PDOException $e )
|
||||||
|
@ -20,15 +20,15 @@ catch( PDOException $e )
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $conn->query( "SELECT name FROM master.dbo.sysdatabases" );
|
$stmt = $conn->query( "SELECT count(*) FROM cd_info" );
|
||||||
if ( $stmt === false )
|
if ( $stmt === false )
|
||||||
{
|
{
|
||||||
echo "Query failed.\n";
|
echo "Query failed.\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$first_db = $stmt->fetch();
|
$result = $stmt->fetch();
|
||||||
var_dump( $first_db );
|
var_dump( $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
$conn = null;
|
$conn = null;
|
||||||
|
@ -39,7 +39,7 @@ $connectionInfo = "Authentication = ActiveDirectoryIntegrated; TrustServerCertif
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$conn = new PDO( "sqlsrv:server = $serverName ; $connectionInfo" );
|
$conn = new PDO( "sqlsrv:server = $server ; $connectionInfo" );
|
||||||
echo "Connected successfully with Authentication=ActiveDirectoryIntegrated.\n";
|
echo "Connected successfully with Authentication=ActiveDirectoryIntegrated.\n";
|
||||||
$conn = null;
|
$conn = null;
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,10 @@ catch( PDOException $e )
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Connected successfully with Authentication=SqlPassword.
|
Connected successfully with Authentication=SqlPassword.
|
||||||
array(2) {
|
array(2) {
|
||||||
["name"]=>
|
[""]=>
|
||||||
string(6) "master"
|
string(1) "7"
|
||||||
[0]=>
|
[0]=>
|
||||||
string(6) "master"
|
string(1) "7"
|
||||||
}
|
}
|
||||||
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
||||||
SQLSTATE[IMSSP]: Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
SQLSTATE[IMSSP]: Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
|
@ -4,49 +4,47 @@ Test the Authentication keyword with options SqlPassword and ActiveDirectoryInte
|
||||||
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("autonomous_setup.php");
|
require_once("MsSetup.inc");
|
||||||
|
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN')
|
$connectionInfo = array( "Database"=>$databaseName, "UID"=>$uid, "PWD"=>$pwd,
|
||||||
|
"Authentication"=>'SqlPassword', "TrustServerCertificate"=>true);
|
||||||
|
|
||||||
|
$conn = sqlsrv_connect( $server, $connectionInfo );
|
||||||
|
|
||||||
|
if( $conn === false )
|
||||||
{
|
{
|
||||||
$connectionInfo = array( "UID"=>$username, "PWD"=>$password,
|
echo "Could not connect with Authentication=SqlPassword.\n";
|
||||||
"Authentication"=>"SqlPassword", "TrustServerCertificate"=>true );
|
var_dump( sqlsrv_errors() );
|
||||||
|
|
||||||
$conn = sqlsrv_connect( $serverName, $connectionInfo );
|
|
||||||
|
|
||||||
if( $conn === false )
|
|
||||||
{
|
|
||||||
echo "Could not connect with Authentication=SqlPassword.\n";
|
|
||||||
print_r( sqlsrv_errors() );
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// echo "Connected successfully with Authentication=SqlPassword.\n";
|
|
||||||
// }
|
|
||||||
|
|
||||||
$stmt = sqlsrv_query( $conn, "SELECT name FROM master.dbo.sysdatabases" );
|
|
||||||
if ( $stmt === false )
|
|
||||||
{
|
|
||||||
echo "Query failed.\n";
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// $first_db = sqlsrv_fetch_array( $stmt );
|
|
||||||
// var_dump( $first_db );
|
|
||||||
// }
|
|
||||||
|
|
||||||
sqlsrv_free_stmt( $stmt );
|
|
||||||
sqlsrv_close( $conn );
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "Connected successfully with Authentication=SqlPassword.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query( $conn, "SELECT count(*) FROM cd_info" );
|
||||||
|
if ( $stmt === false )
|
||||||
|
{
|
||||||
|
echo "Query failed.\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = sqlsrv_fetch_array( $stmt );
|
||||||
|
var_dump( $result );
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlsrv_free_stmt( $stmt );
|
||||||
|
sqlsrv_close( $conn );
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
|
||||||
$connectionInfo = array( "Authentication"=>"ActiveDirectoryIntegrated", "TrustServerCertificate"=>true );
|
$connectionInfo = array( "Authentication"=>"ActiveDirectoryIntegrated", "TrustServerCertificate"=>true );
|
||||||
|
|
||||||
$conn = sqlsrv_connect( $serverName, $connectionInfo );
|
$conn = sqlsrv_connect( $server, $connectionInfo );
|
||||||
if( $conn === false )
|
if( $conn === false )
|
||||||
{
|
{
|
||||||
echo "Could not connect with Authentication=ActiveDirectoryIntegrated.\n";
|
echo "Could not connect with Authentication=ActiveDirectoryIntegrated.\n";
|
||||||
print_r( sqlsrv_errors() );
|
$errors = sqlsrv_errors();
|
||||||
|
print_r($errors[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -56,17 +54,20 @@ else
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
|
Connected successfully with Authentication=SqlPassword.
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
int(7)
|
||||||
|
[""]=>
|
||||||
|
int(7)
|
||||||
|
}
|
||||||
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
Could not connect with Authentication=ActiveDirectoryIntegrated.
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
[0] => Array
|
[0] => IMSSP
|
||||||
(
|
[SQLSTATE] => IMSSP
|
||||||
[0] => IMSSP
|
[1] => -62
|
||||||
[SQLSTATE] => IMSSP
|
[code] => -62
|
||||||
[1] => -62
|
[2] => Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
||||||
[code] => -62
|
[message] => Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
||||||
[2] => Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
)
|
||||||
[message] => Invalid option for the Authentication keyword. Only SqlPassword or ActiveDirectoryPassword is supported.
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
Loading…
Reference in a new issue