Skip to content

164577111 add sqlsrv via centos php php container#1

Open
neiljisc wants to merge 6 commits into
masterfrom
164577111-add-sqlsrv-via-centos-php-php-container
Open

164577111 add sqlsrv via centos php php container#1
neiljisc wants to merge 6 commits into
masterfrom
164577111-add-sqlsrv-via-centos-php-php-container

Conversation

@neiljisc

@neiljisc neiljisc commented Apr 1, 2019

Copy link
Copy Markdown

Adds sqlsrv support.

Test:

Usng this branch with jisc-collections-symfony available in the root of docker4php:

add this to .env.local:

PROJECT_NAME=my_php7_project_sqlrc

( prevents container name conflicts )

make stop
make

Create a check.php page in /public:

<?php

phpinfo();

Check that

curl http://php.docker.localhost:8000/check.php | grep sqlsrv

is not empty

Then:

Create

connect.php

in /var/www/html and add this to it.

<?php

$serverName = "d365finance.database.windows.net"; //serverName\instanceName

// Since UID and PWD are not specified in the $connectionInfo array,

// The connection will be attempted using Windows Authentication.

$connectionInfo = array( "Database"=>"D365Mirror", "UID"=>"D365Query", "PWD"=>"########");

$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {

     echo "Connection established.<br />";

}else{

     echo "Connection could not be established.<br />";

     die( print_r( sqlsrv_errors(), true));

}

?>

Change the password param to match the password sent via email

php connect.php

should show:

Connection established.<br />

@reubenporterjisc reubenporterjisc self-requested a review April 1, 2019 09:31
@neiljisc

neiljisc commented Apr 1, 2019

Copy link
Copy Markdown
Author

I've already found an issue with this so no need to review just now.

@reubenporterjisc reubenporterjisc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All works fine.

@saulwilcox-jisc saulwilcox-jisc self-requested a review April 3, 2019 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants