From 3918ac45f4a7255f5504160dc5a259fd35bcb47d Mon Sep 17 00:00:00 2001 From: ulvii Date: Fri, 3 Mar 2017 15:06:46 -0800 Subject: [PATCH 01/24] Initial Mac instructions --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b044707c6..c06eecd3a 100644 --- a/README.md +++ b/README.md @@ -79,8 +79,8 @@ This software has been compiled and tested under PHP 7.0.8 using the Visual C++ 3. Restart the Web server. -## Install (Linux) -Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apache, and Microsoft PHP drivers on Ubuntu 15, 16 and RedHat 7. To see how to get PHP SQLSRV drivers running on Debian, please visit [Wiki](https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-getting-pdo_sqlsrv-for-PHP-7.0-on-Debian-in-3-ways). Note that Debian is not officially supported and this instruction hasn't been tested in our test lab. +## Install (UNIX) +Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apache, and Microsoft PHP drivers on Ubuntu 15, 16, RedHat 7 and Mac OS X. To see how to get PHP SQLSRV drivers running on Debian, please visit [Wiki](https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-getting-pdo_sqlsrv-for-PHP-7.0-on-Debian-in-3-ways). Note that Debian is not officially supported and this instruction hasn't been tested in our test lab. ### Step 1: Install PHP (unless already installed) @@ -112,6 +112,14 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac yum update yum install php php-pdo php-xml php-pear php-devel re2c gcc-c++ gcc +**Mac OS X** + + brew tap + brew tap homebrew/dupes + brew tap homebrew/versions + brew tap homebrew/homebrew-php + brew install php70 +Note: If php is not updated, do sudo vi /etc/paths and make sure that /usr/local/bin is above /usr/bin. #### PHP 7.1 @@ -135,7 +143,14 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac yum update yum install php php-pdo php-xml php-pear php-devel - +**Mac OS X** + + brew tap + brew tap homebrew/dupes + brew tap homebrew/versions + brew tap homebrew/homebrew-php + brew install php71 +Note: If php is not updated, do sudo vi /etc/paths and make sure that /usr/local/bin is above /usr/bin. ### Step 2: Install pre-requisites @@ -180,10 +195,17 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc source ~/.bashrc + +**Mac OS X** + brew tap microsoft/msodbcsql https://github.com/Microsoft/homebrew-msodbcsql + brew update + brew install unixodbc + brew install msodbcsql + brew install llvm --with-clang --with-clang-extra-tools + brew install autoconf - -*Note: On Ubuntu, you need to make sure you install PHP 7 before you proceed to step 2. The Microsoft PHP Drivers for SQL Server will only work for PHP 7+. +*Note: You need to make sure you install PHP 7 before you proceed to step 2. The Microsoft PHP Drivers for SQL Server will only work for PHP 7+. ### Step 3: Install Apache @@ -198,6 +220,11 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac sudo yum install httpd +**Mac OS X** + + brew install -v homebrew/apache/httpd22 --with-brewed-openssl --with-mpm-event + brew install -v homebrew/apache/mod_fastcgi --with-brewed-httpd22 + ####PHP 7.1 **Ubuntu** @@ -208,6 +235,11 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac **RedHat** sudo yum install httpd + +**Mac OS X** + + brew install -v homebrew/apache/httpd22 --with-brewed-openssl --with-mpm-event + brew install -v homebrew/apache/mod_fastcgi --with-brewed-httpd22 ### Step 4: Install the Microsoft PHP Drivers for SQL Server @@ -235,6 +267,11 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /etc/php.d/sqlsrv.ini echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini + +**Mac OS X** + + echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /usr/local/etc/php/7.0/php.ini + echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /usr/local/etc/php/7.0/php.ini ####PHP 7.1 @@ -254,7 +291,10 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /etc/php.d/sqlsrv.ini echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini +**Mac OS X** + echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /usr/local/etc/php/7.1/php.ini + echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /usr/local/etc/php/7.1/php.ini ### Step 6: Restart Apache to load the new php.ini file @@ -265,11 +305,15 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac **RedHat** sudo apachectl restart + +**Mac OS X** + + apachectl restart *Note to RedHat users: SELinux is installed by default and runs in Enforcing mode. To allow Apache to connect to database through SELinux, do this `sudo setsebool -P httpd_can_network_connect_db 1` ### Step 7: Create your sample app -Navigate to `/var/www/html` and create a new file called testsql.php. Copy and paste the following code in tetsql.php and change the servername, username, password and databasename. +Navigate to `/var/www/html` (`/Library/WebServer/Documents` on Mac) and create a new file called testsql.php. Copy and paste the following code in tetsql.php and change the servername, username, password and databasename. Date: Tue, 7 Mar 2017 11:13:12 -0800 Subject: [PATCH 02/24] Add pecl install for mac --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c06eecd3a..ba51938e1 100644 --- a/README.md +++ b/README.md @@ -114,12 +114,13 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac **Mac OS X** + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew tap brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php - brew install php70 -Note: If php is not updated, do sudo vi /etc/paths and make sure that /usr/local/bin is above /usr/bin. + brew install php70 --with-pear +Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. #### PHP 7.1 @@ -145,12 +146,13 @@ Note: If php is not updated, do sudo vi /etc/paths and make sure that /usr/local **Mac OS X** + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew tap brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php - brew install php71 -Note: If php is not updated, do sudo vi /etc/paths and make sure that /usr/local/bin is above /usr/bin. + brew install php71 --with-pear +Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. ### Step 2: Install pre-requisites From 4fa3112d3e48b28e802e7dc19e9861ab7c762f33 Mon Sep 17 00:00:00 2001 From: ulvii Date: Tue, 7 Mar 2017 11:41:41 -0800 Subject: [PATCH 03/24] Changing instructions for loading the drivers --- README.md | 45 ++------------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index ba51938e1..5f19ae4e3 100644 --- a/README.md +++ b/README.md @@ -254,49 +254,8 @@ Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/lo ### Step 5: Add the Microsoft PHP Drivers for SQL Server to php.ini - -####PHP 7.0 - -**Ubuntu** - - echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/apache2/php.ini - echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/apache2/php.ini - echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/cli/php.ini - echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/cli/php.ini - - -**RedHat** - - echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /etc/php.d/sqlsrv.ini - echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini - -**Mac OS X** - - echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /usr/local/etc/php/7.0/php.ini - echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /usr/local/etc/php/7.0/php.ini - - -####PHP 7.1 - - -**Ubuntu 16.04** - - echo "extension=/usr/lib/php/20160303/sqlsrv.so" >> /etc/php/7.1/apache2/php.ini - echo "extension=/usr/lib/php/20160303/pdo_sqlsrv.so" >> /etc/php/7.1/apache2/php.ini - echo "extension=/usr/lib/php/20160303/sqlsrv.so" >> /etc/php/7.1/cli/php.ini - echo "extension=/usr/lib/php/20160303/pdo_sqlsrv.so" >> /etc/php/7.1/cli/php.ini - - - -**RedHat** - - echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /etc/php.d/sqlsrv.ini - echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini - -**Mac OS X** - - echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /usr/local/etc/php/7.1/php.ini - echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /usr/local/etc/php/7.1/php.ini + echo "extension= sqlsrv.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` + echo "extension= pdo_sqlsrv.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` ### Step 6: Restart Apache to load the new php.ini file From 741fde8633d5f6b068a6297e6ea0bbd07c0038d3 Mon Sep 17 00:00:00 2001 From: ulvii Date: Tue, 7 Mar 2017 14:35:38 -0800 Subject: [PATCH 04/24] Updating apache install intructions for MAC --- README.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5f19ae4e3..f0468832b 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php - brew install php70 --with-pear + brew install php70 --with-pear --with-httpd24 Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. @@ -151,7 +151,7 @@ Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/lo brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php - brew install php71 --with-pear + brew install php71 --with-pear --with-httpd24 Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. @@ -223,25 +223,21 @@ Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/lo sudo yum install httpd **Mac OS X** - - brew install -v homebrew/apache/httpd22 --with-brewed-openssl --with-mpm-event - brew install -v homebrew/apache/mod_fastcgi --with-brewed-httpd22 + Installed with PHP. ####PHP 7.1 **Ubuntu** - sudo apt-get install libapache2-mod-php7.1 - sudo apt-get install apache2 + sudo apt-get install libapache2-mod-php7.1 + sudo apt-get install apache2 **RedHat** sudo yum install httpd **Mac OS X** - - brew install -v homebrew/apache/httpd22 --with-brewed-openssl --with-mpm-event - brew install -v homebrew/apache/mod_fastcgi --with-brewed-httpd22 + Installed with PHP. ### Step 4: Install the Microsoft PHP Drivers for SQL Server @@ -269,7 +265,7 @@ Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/lo **Mac OS X** - apachectl restart + sudo apachectl restart *Note to RedHat users: SELinux is installed by default and runs in Enforcing mode. To allow Apache to connect to database through SELinux, do this `sudo setsebool -P httpd_can_network_connect_db 1` From 41e4ab6c61f8e9677930ee38ba4e5289a1236931 Mon Sep 17 00:00:00 2001 From: ulvii Date: Tue, 7 Mar 2017 15:14:32 -0800 Subject: [PATCH 05/24] Adding Mac related notes --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f0468832b..305699bf6 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac brew tap homebrew/versions brew tap homebrew/homebrew-php brew install php70 --with-pear --with-httpd24 -Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. +*Note: If PHP(`php -v`) is not updated on Mac, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. #### PHP 7.1 @@ -152,7 +152,7 @@ Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/lo brew tap homebrew/versions brew tap homebrew/homebrew-php brew install php71 --with-pear --with-httpd24 -Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. +*Note: If PHP(`php -v`) is not updated, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. ### Step 2: Install pre-requisites @@ -246,6 +246,7 @@ Note: If php is not updated, do `sudo vi /etc/paths` and make sure that `/usr/lo sudo pecl install pdo_sqlsrv *Note: it installs the stable version, for specific version you should set the version. For example, `sudo pecl install sqlsrv-4.0.8` +Drivers are Mac-compatible starting from 4.1.7preview release. Do `sudo pecl search sqlsrv`. ### Step 5: Add the Microsoft PHP Drivers for SQL Server to php.ini From 55d9aa3d1867fd15932fbf73336619753604e2f5 Mon Sep 17 00:00:00 2001 From: ulvii Date: Tue, 7 Mar 2017 15:19:25 -0800 Subject: [PATCH 06/24] Minor cleanup --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 305699bf6..ae5cf1451 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,8 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac sudo yum install httpd **Mac OS X** - Installed with PHP. + +Installed with PHP. ####PHP 7.1 @@ -237,7 +238,8 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac sudo yum install httpd **Mac OS X** - Installed with PHP. + +Installed with PHP. ### Step 4: Install the Microsoft PHP Drivers for SQL Server @@ -245,7 +247,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac sudo pecl install sqlsrv sudo pecl install pdo_sqlsrv -*Note: it installs the stable version, for specific version you should set the version. For example, `sudo pecl install sqlsrv-4.0.8` +*Note: it installs the stable version, for specific version you should set the version. For example, `sudo pecl install sqlsrv-4.0.8`. Drivers are Mac-compatible starting from 4.1.7preview release. Do `sudo pecl search sqlsrv`. From 4702c287e376da52ca28648fb07b064996fdaecb Mon Sep 17 00:00:00 2001 From: David Puglielli Date: Thu, 2 Mar 2017 11:29:40 -0800 Subject: [PATCH 07/24] appveyor.yml now outputs details of failing tests --- appveyor.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f45dc84d4..98edf7508 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -165,7 +165,11 @@ test_script: after_test: - cd %APPVEYOR_BUILD_FOLDER%\test\ - - python output.py + - python output.py + - ps: $files = Get-ChildItem sqlsrv\*.diff + - ps: foreach($file in $files){ls $file; more $file; more "$file.out"} + - ps: $files = Get-ChildItem pdo_sqlsrv\*.diff + - ps: foreach($file in $files){ls $file; more $file; more "$file.out"} - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult1.xml)) - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult2.xml)) - ps: >- From a13839a2e5fd5b15e6f66e321b414c417004445d Mon Sep 17 00:00:00 2001 From: Hadis Kakanejadi Fard Date: Fri, 3 Mar 2017 16:54:30 -0800 Subject: [PATCH 08/24] updated versioning to semantic versioning #282 --- source/pdo_sqlsrv/template.rc | 8 ++++---- source/shared/version.h | 21 ++++++++++++++++----- source/sqlsrv/template.rc | 8 ++++---- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/source/pdo_sqlsrv/template.rc b/source/pdo_sqlsrv/template.rc index d36cd82fb..285762db5 100644 --- a/source/pdo_sqlsrv/template.rc +++ b/source/pdo_sqlsrv/template.rc @@ -43,8 +43,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US //Version VS_VERSION_INFO VERSIONINFO - FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE, SQLVERSION_BUILD - PRODUCTVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_RELEASE,0 + FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH, SQLVERSION_BUILD + PRODUCTVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_PATCH,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG @@ -62,12 +62,12 @@ BEGIN VALUE "Comments", "This product includes PHP software that is freely available from http://www.php.net/software/. Copyright © 2001-2016 The PHP Group. All rights reserved.\0" VALUE "CompanyName", "Microsoft Corp.\0" VALUE "FileDescription", "Microsoft Drivers for PHP for SQL Server (PDO Driver)\0" - VALUE "FileVersion", STRVER4(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE, SQLVERSION_BUILD) + VALUE "FileVersion", STRVER4(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH, SQLVERSION_BUILD) VALUE "InternalName", FILE_NAME "\0" VALUE "LegalCopyright", "Copyright Microsoft Corporation.\0" VALUE "OriginalFilename", FILE_NAME "\0" VALUE "ProductName", "Microsoft Drivers for PHP for SQL Server\0" - VALUE "ProductVersion", STRVER3(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE) + VALUE "ProductVersion", STRVER3(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH) VALUE "URL", "http://www.microsoft.com\0" END END diff --git a/source/shared/version.h b/source/shared/version.h index c6c5a0c91..604ed9f43 100644 --- a/source/shared/version.h +++ b/source/shared/version.h @@ -24,13 +24,24 @@ #define SQLVERSION_MAJOR 4 #define SQLVERSION_MINOR 1 -#define SQLVERSION_RELEASE 6 +#define SQLVERSION_PATCH 7 #define SQLVERSION_BUILD 0 -#define VER_FILEVERSION_STR STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_RELEASE ) "." STRINGIFY( SQLVERSION_BUILD ) -#define _FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_RELEASE,SQLVERSION_BUILD -#define PHP_SQLSRV_VERSION STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_RELEASE ) -#define PHP_PDO_SQLSRV_VERSION PHP_SQLSRV_VERSION +// Semantic versioning pre-release and buil metadata +#define SEMVER_PRERELEASE "-preview" +#define SEMVER_BUILDMETA + +#if SQLVERSION_BUILD > 0 +#undef SEMVER_BUILDMETA +#define SEMVER_BUILDMETA "+" STRINGIFY( SQLVERSION_BUILD ) +#endif + +#define VER_FILEVERSION_STR STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_PATCH ) SEMVER_PRERELEASE SEMVER_BUILDMETA +#define _FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_PATCH,SQLVERSION_BUILD + +//PECL extension verison macros +#define PHP_SQLSRV_VERSION VER_FILEVERSION_STR +#define PHP_PDO_SQLSRV_VERSION VER_FILEVERSION_STR #endif // VERSION_H diff --git a/source/sqlsrv/template.rc b/source/sqlsrv/template.rc index 5d148c59c..0e20602d6 100644 --- a/source/sqlsrv/template.rc +++ b/source/sqlsrv/template.rc @@ -43,8 +43,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US //Version VS_VERSION_INFO VERSIONINFO - FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE, SQLVERSION_BUILD - PRODUCTVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_RELEASE,0 + FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH, SQLVERSION_BUILD + PRODUCTVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG @@ -62,12 +62,12 @@ BEGIN VALUE "Comments", "This product includes PHP software that is freely available from http://www.php.net/software/. Copyright © 2001-2016 The PHP Group. All rights reserved.\0" VALUE "CompanyName", "Microsoft Corp.\0" VALUE "FileDescription", "Microsoft Drivers for PHP for SQL Server\0" - VALUE "FileVersion", STRVER4(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE, SQLVERSION_BUILD) + VALUE "FileVersion", STRVER4(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH, SQLVERSION_BUILD) VALUE "InternalName", FILE_NAME "\0" VALUE "LegalCopyright", "Copyright Microsoft Corporation.\0" VALUE "OriginalFilename", FILE_NAME "\0" VALUE "ProductName", "Microsoft Drivers for PHP for SQL Server\0" - VALUE "ProductVersion", STRVER3(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE) + VALUE "ProductVersion", STRVER3(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH) VALUE "URL", "http://www.microsoft.com\0" END END From f4d116a0fca1c6acfbfee41f2327669dfa1ae13b Mon Sep 17 00:00:00 2001 From: Meet Bhagdev Date: Fri, 3 Mar 2017 17:53:32 -0800 Subject: [PATCH 09/24] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b044707c6..3721ff50f 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Thank you for taking time to take our Febraury survey. Let us know how we are do * [**Ubuntu + SQL Server + PHP 7**](https://www.microsoft.com/en-us/sql-server/developer-get-started/php-ubuntu) * [**RedHat + SQL Server + PHP 7**](https://www.microsoft.com/en-us/sql-server/developer-get-started/php-rhel) * [**Windows + SQL Server + PHP 7**](https://www.microsoft.com/en-us/sql-server/developer-get-started/php-windows) +* [**Docker**](https://hub.docker.com/r/lbosqmsft/mssql-php-msphpsql/) ##Announcements From a6231ea19b74c14ce788b8ed93e9f7aced2585b9 Mon Sep 17 00:00:00 2001 From: yitam Date: Fri, 3 Mar 2017 17:54:42 -0800 Subject: [PATCH 10/24] changed locale for mac --- source/shared/localizationimpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/shared/localizationimpl.cpp b/source/shared/localizationimpl.cpp index eb66d34a5..bff427211 100644 --- a/source/shared/localizationimpl.cpp +++ b/source/shared/localizationimpl.cpp @@ -311,7 +311,7 @@ const SystemLocale & SystemLocale::Singleton() #if !defined(__GNUC__) || defined(NO_THREADSAFE_STATICS) #error "Relying on GCC's threadsafe initialization of local statics." #endif - static const SystemLocale s_Default( "en_US.utf8" ); + static const SystemLocale s_Default( "en_US.utf-8" ); return s_Default; } From 5e69182411d6b9d4833ae068fb88267792f5cd50 Mon Sep 17 00:00:00 2001 From: Hadis Kakanejadi Fard Date: Fri, 3 Mar 2017 18:25:08 -0800 Subject: [PATCH 11/24] added client info tests --- .../pdo_getAttribute_clientInfo.phpt | 22 ++++++++++++++++ test/sqlsrv/sqlsrv_client_info.phpt | 25 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 test/pdo_sqlsrv/pdo_getAttribute_clientInfo.phpt create mode 100644 test/sqlsrv/sqlsrv_client_info.phpt diff --git a/test/pdo_sqlsrv/pdo_getAttribute_clientInfo.phpt b/test/pdo_sqlsrv/pdo_getAttribute_clientInfo.phpt new file mode 100644 index 000000000..f85a0e35c --- /dev/null +++ b/test/pdo_sqlsrv/pdo_getAttribute_clientInfo.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test client info by calling PDO::getAttribute with PDO::ATTR_CLIENT_VERSION +--FILE-- +getAttribute( PDO::ATTR_CLIENT_VERSION )); + +//free the connection +$conn=null; +?> +--EXPECTREGEX-- +Array +\( + \[(DriverDllName|DriverName)\] => (msodbcsql1[1-9].dll|libmsodbcsql-[1-9]{2}.[0-9].so.[0-9].[0-9]) + \[DriverODBCVer\] => [0-9]{1,2}\.[0-9]{1,2} + \[DriverVer\] => [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4} + \[ExtensionVer\] => [0-9]\.[0-9]\.[0-9](\-((rc)|(preview))(\.[0-9]+)?)?(\+[0-9]+)? +\) \ No newline at end of file diff --git a/test/sqlsrv/sqlsrv_client_info.phpt b/test/sqlsrv/sqlsrv_client_info.phpt new file mode 100644 index 000000000..9fad7661e --- /dev/null +++ b/test/sqlsrv/sqlsrv_client_info.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test sqlsrv_client_info +--SKIPIF-- +--FILE-- + +--EXPECTREGEX-- +array\(4\) { + \[\"(DriverDllName|DriverName)\"\]=> + (string\(15\) \"msodbcsql1[1-9].dll\"|string\(24\) \"libmsodbcsql-[1-9]{2}.[0-9].so.[0-9].[0-9]\") + \[\"DriverODBCVer\"\]=> + string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\" + \[\"DriverVer\"\]=> + string\(10\) \"[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}\" + \[\"ExtensionVer\"\]=> + string\([0-9]+\) \"[0-9]\.[0-9]\.[0-9](\-((rc)|(preview))(\.[0-9]+)?)?(\+[0-9]+)?" +} \ No newline at end of file From b96bda88cb76b5a8ec9953a635c2883d27eae59d Mon Sep 17 00:00:00 2001 From: Hadis Kakanejadi Fard Date: Mon, 6 Mar 2017 18:02:41 -0800 Subject: [PATCH 12/24] added versioning notes --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 3721ff50f..bf87011f0 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This release contains the SQLSRV and PDO_SQLSRV drivers for PHP 7 with improveme SQL Server Team + ##Take our survey Thank you for taking time to take our Febraury survey. Let us know how we are doing and how you use PHP by taking our March pulse survey: @@ -341,6 +342,23 @@ For samples, please see the sample folder. For setup instructions, see [here] [ - In certain scenarios a generic error message maybe returned instead of a specific error when pooling is disabled - When retrieving data from columns with a data type of XML, varchar(max), nvarchar(max), or varbinary(max) no data maybe returned or the data maybe truncated depending on the length of the data in the source table. +##Version number +Version number of PHP drivers follow the [semantic versioning](http://semver.org/): + +Given a version number MAJOR.MINOR.PATCH, + + - MAJOR version is incremented when an incompatible API changes is made, + - MINOR version is incremented when a functionality in a backwards-compatible manner is added, and + - PATCH version is incremented when backwards-compatible bug fixes are made. + +version number MAY have trailing pre-release version to indicate the stability, and/or build meta data. + +- Pre-release version is be denoted by hyphen followed by `preview` or `rc` keyword and may be followed by a series of dot separated identifiers. Production quality releases do not contain the pre-release version. `preview` has lower precedence than `rc`. Example of precedence: *1.2.3-preview < 1.2.3-preview.1 < 1.2.3-rc < 1.2.3 < 1.3.0*. +*Note that PECL package version does not have the hyphen before pre-release version, due to limitation in PECL. Example of package version: 1.2.3preview* +- Build metadata MAY be denoted by a plus sign followed by 4 digits, such as `1.2.3-preview+5678` or `1.2.3+5678`. Build meta data does NOT figure into the precedence order. + + + ## Future Plans - Expand SQL 16 Feature Support (example: Always Encrypted). - Build Verification/Fundamental Tests. From b017ce8322bd62c8334b7f69df12f9abe8eb563c Mon Sep 17 00:00:00 2001 From: Hadis Kakanejadi Fard Date: Tue, 7 Mar 2017 10:27:00 -0800 Subject: [PATCH 13/24] updated precedence order example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bf87011f0..adc2e2f31 100644 --- a/README.md +++ b/README.md @@ -353,8 +353,8 @@ Given a version number MAJOR.MINOR.PATCH, version number MAY have trailing pre-release version to indicate the stability, and/or build meta data. -- Pre-release version is be denoted by hyphen followed by `preview` or `rc` keyword and may be followed by a series of dot separated identifiers. Production quality releases do not contain the pre-release version. `preview` has lower precedence than `rc`. Example of precedence: *1.2.3-preview < 1.2.3-preview.1 < 1.2.3-rc < 1.2.3 < 1.3.0*. -*Note that PECL package version does not have the hyphen before pre-release version, due to limitation in PECL. Example of package version: 1.2.3preview* +- Pre-release version is denoted by hyphen followed by `preview` or `rc` keyword and may be followed by a series of dot separated identifiers. Production quality releases do not contain the pre-release version. `preview` has lower precedence than `rc`. Example of precedence: *preview < preview.1 < rc < rc.1*. +*Note that PECL package version does not have the hyphen before pre-release version, due to restrictions in PECL. Example of PECL package version: 1.2.3preview* - Build metadata MAY be denoted by a plus sign followed by 4 digits, such as `1.2.3-preview+5678` or `1.2.3+5678`. Build meta data does NOT figure into the precedence order. From 75d195ff222cf9b5401436bbb91bb88d0867ecdf Mon Sep 17 00:00:00 2001 From: v-kaywon Date: Tue, 7 Mar 2017 10:51:38 -0800 Subject: [PATCH 14/24] added 4.1.7 to changedlog --- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b78e5999..143d05486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) +## Windows/Linux/MAC 4.1.7 - 2017-03-07 +Updated PECL release packages. Here is the list of updates: +### Added +- The early technical preview (ETP) for SQLSRV and PDO_SQLSRV drivers for MAC with basic functionalities is now available. Both drivers has been built and tested on MAC OS versions El Capitan (OS X 10.11) and Sierra (macOS 10.12). + +### Fixed +#### SQLSRV and PDO_SQLSRV +- Fixed null returned when an empty string is set to an output parameter ([issue #308](https://github.com/Microsoft/msphpsql/issues/308)). +- Fixed memory leaks in buffered result sets. +- Fixed clang compile errors. + +#### SQLSRV only +- Fixed debug abort error when building the driver in debug mode with PHP 7.1. +- Fixed string truncation when binding varchar(max), nvarchar(max), varbinary(max), and xml types ([issue #231](https://github.com/Microsoft/msphpsql/issues/231)). +- Fixed fatal error when fetching empty nvarchar ([issue #69](https://github.com/Microsoft/msphpsql/issues/69)). +- Fixed fatal error when calling sqlsrv_fetch() with an out of bound offset for SQLSRV_SCROLL_ABSOLUTE ([issue #223](https://github.com/Microsoft/msphpsql/issues/223)). + +#### PDO_SQLSRV only +- Fixed wrong value returned when fetching varbinary value on Linux ([issue #270](https://github.com/Microsoft/msphpsql/issues/270)). +- Fixed binary data not returned when the column is bound by name ([issue #35](https://github.com/Microsoft/msphpsql/issues/35)). +- Fixed exception thrown on closeCursor() when the statement has not been executed ([issue #267](https://github.com/Microsoft/msphpsql/issues/267)). + +### Known Issues +- User defined data types and SQL_VARIANT ([issue #127](https://github.com/Microsoft/msphpsql/issues/127)). +- Binary column binding with emulate prepare ([issue #140](https://github.com/Microsoft/msphpsql/issues/140)). +- Segmentation fault may result when an unsupported attribute is used for connection. +#### MAC only +- If loading both sqlsrv and pdo_sqlsrv, the order matters (even when dynamically). For PDO scripts, load pdo_sqlsrv.so first. +- Connection pooling not working. + ## Windows/Linux 4.1.6 - 2017-02-03 Updated PECL release packages. Here is the list of updates: ### Added From 267a617bb2f747dc996b125256c17f9947786816 Mon Sep 17 00:00:00 2001 From: Hadis Kakanejadi Fard Date: Tue, 7 Mar 2017 11:13:53 -0800 Subject: [PATCH 15/24] updated PECL package version --- source/shared/version.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/source/shared/version.h b/source/shared/version.h index 604ed9f43..88c0c15a9 100644 --- a/source/shared/version.h +++ b/source/shared/version.h @@ -27,8 +27,9 @@ #define SQLVERSION_PATCH 7 #define SQLVERSION_BUILD 0 -// Semantic versioning pre-release and buil metadata -#define SEMVER_PRERELEASE "-preview" +// Semantic versioning pre-release, for stable releases should be empty +#define SEMVER_PRERELEASE "preview" +// Semantic versioning build metadata #define SEMVER_BUILDMETA #if SQLVERSION_BUILD > 0 @@ -36,13 +37,15 @@ #define SEMVER_BUILDMETA "+" STRINGIFY( SQLVERSION_BUILD ) #endif -#define VER_FILEVERSION_STR STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_PATCH ) SEMVER_PRERELEASE SEMVER_BUILDMETA +// Main version +#define VER_APIVERSION_STR STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_PATCH ) + +// Remove "-" if SEMVER_PRERELEASE is empty (for stable releases) +#define VER_FILEVERSION_STR VER_APIVERSION_STR "-" SEMVER_PRERELEASE SEMVER_BUILDMETA #define _FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_PATCH,SQLVERSION_BUILD -//PECL extension verison macros -#define PHP_SQLSRV_VERSION VER_FILEVERSION_STR -#define PHP_PDO_SQLSRV_VERSION VER_FILEVERSION_STR +// PECL package version macros (can't have '-' or '+') +#define PHP_SQLSRV_VERSION VER_APIVERSION_STR SEMVER_PRERELEASE +#define PHP_PDO_SQLSRV_VERSION PHP_SQLSRV_VERSION #endif // VERSION_H - - From 0878863e4e540674bac59fbe339338322b315db1 Mon Sep 17 00:00:00 2001 From: v-kaywon Date: Tue, 7 Mar 2017 11:21:06 -0800 Subject: [PATCH 16/24] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 143d05486..b95cbec18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Updated PECL release packages. Here is the list of updates: - User defined data types and SQL_VARIANT ([issue #127](https://github.com/Microsoft/msphpsql/issues/127)). - Binary column binding with emulate prepare ([issue #140](https://github.com/Microsoft/msphpsql/issues/140)). - Segmentation fault may result when an unsupported attribute is used for connection. + #### MAC only - If loading both sqlsrv and pdo_sqlsrv, the order matters (even when dynamically). For PDO scripts, load pdo_sqlsrv.so first. - Connection pooling not working. @@ -91,7 +92,7 @@ Linux drivers compiled with PHP 7.0.13 are available for Ubuntu 15.04, Ubuntu 16 ### Changed - Code structure is updated to facilitate the development; shared codes between both drivers are moved to "shared" folder to avoid code duplication issues in development. To build the driver from source, use "packagize" script as follows: - - if you are using the phpize, clone or download the source, run the script within the source directory and then run phpize. + - if you are using the phpize, clone or download the “source”, run the script within the “source” directory and then run phpize. - if you are building the driver from source using PHP source, give the path to the PHP source to the script. ### Fixed From 7cf86e639fa2efbcf7800295bae2483b2b80e773 Mon Sep 17 00:00:00 2001 From: v-kaywon Date: Tue, 7 Mar 2017 11:23:25 -0800 Subject: [PATCH 17/24] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b95cbec18..e080ef8ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) -## Windows/Linux/MAC 4.1.7 - 2017-03-07 +## Windows/Linux/MAC 4.1.7-preview - 2017-03-07 Updated PECL release packages. Here is the list of updates: ### Added -- The early technical preview (ETP) for SQLSRV and PDO_SQLSRV drivers for MAC with basic functionalities is now available. Both drivers has been built and tested on MAC OS versions El Capitan (OS X 10.11) and Sierra (macOS 10.12). +- The early technical preview (ETP) for SQLSRV and PDO_SQLSRV drivers for MAC with basic functionalities is now available. Both drivers has been built and tested on MAC OS version El Capitan (OS X 10.11). ### Fixed #### SQLSRV and PDO_SQLSRV From ac2c0c8b514f5c7607e3e5a2410d1fe9debe259c Mon Sep 17 00:00:00 2001 From: v-kaywon Date: Tue, 7 Mar 2017 11:24:40 -0800 Subject: [PATCH 18/24] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e080ef8ec..0db098013 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ Updated PECL release packages. Here is the list of updates: - Segmentation fault may result when an unsupported attribute is used for connection. #### MAC only -- If loading both sqlsrv and pdo_sqlsrv, the order matters (even when dynamically). For PDO scripts, load pdo_sqlsrv.so first. +- If loading both sqlsrv and pdo_sqlsrv, the order matters (even when dynamically). For PDO_SQLSRV scripts, load pdo_sqlsrv.so first. For SQLSRV scripts, load sqlsrv.so first. - Connection pooling not working. ## Windows/Linux 4.1.6 - 2017-02-03 From 3ed11cc68056e35df155df2d0af2d1138b87332b Mon Sep 17 00:00:00 2001 From: Hadis Kakanejadi Fard Date: Tue, 7 Mar 2017 15:21:15 -0800 Subject: [PATCH 19/24] MAC OS X announcement --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index adc2e2f31..9f1e13ce7 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Thank you for taking time to take our Febraury survey. Let us know how we are do ##Announcements -**December 19, 2016**: We are delighted announce that production release for PHP Linux Driver for SQL Server is available. PECL packages (4.0.8) are updated with the latest changes, and Linux binaries (4.0.8) compiled with PHP 7.0.14 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2. For complete list of changes please visit [CHANGELOG](https://github.com/Microsoft/msphpsql/blob/dev/CHANGELOG.md) file. +**March 7, 2017**: We are trilled to announce that the early technical preview for SQLSRV and PDO_SQLSRV drivers is now available, both drivers have been built and tested on El Capitan (OS X 10.11). For complete list of changes please visit [4.1.7-preview release notes](https://github.com/Microsoft/msphpsql/releases/tag/v4.1.7-preview). Please visit the [blog][blog] for more announcements. From a6416d7831287b5ea19135ad14cfd43afdf84011 Mon Sep 17 00:00:00 2001 From: ulvii Date: Wed, 8 Mar 2017 16:31:03 -0800 Subject: [PATCH 20/24] Updating Mac Apache Instructions. Also removing the step of manually adding drivers to the ini file. --- README.md | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index eb4429e60..df827d771 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ This software has been compiled and tested under PHP 7.0.8 using the Visual C++ ## Install (UNIX) Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apache, and Microsoft PHP drivers on Ubuntu 15, 16, RedHat 7 and Mac OS X. To see how to get PHP SQLSRV drivers running on Debian, please visit [Wiki](https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-getting-pdo_sqlsrv-for-PHP-7.0-on-Debian-in-3-ways). Note that Debian is not officially supported and this instruction hasn't been tested in our test lab. -### Step 1: Install PHP (unless already installed) +### Step 1: Install PHP7 (unless already installed) #### PHP 7.0 @@ -121,8 +121,10 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php - brew install php70 --with-pear --with-httpd24 -*Note: If PHP(`php -v`) is not updated on Mac, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. + brew install php70 --with-pear --with-httpd24 --with-cgi + echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile + echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile +*Note: Restart the terminal if PHP(`php -v`) is not updated. #### PHP 7.1 @@ -153,8 +155,10 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php - brew install php71 --with-pear --with-httpd24 -*Note: If PHP(`php -v`) is not updated, do `sudo vi /etc/paths` and make sure that `/usr/local/bin` appears before `/usr/bin` and restart the terminal. + brew install php71 --with-pear --with-httpd24 --with-cgi + echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile + echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile +*Note: Restart the terminal if PHP(`php -v`) is not updated. ### Step 2: Install pre-requisites @@ -226,7 +230,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac **Mac OS X** -Installed with PHP. + echo " SetHandler application/x-httpd-php " >> /usr/local/etc/apache2/2.4/httpd.conf ####PHP 7.1 @@ -241,24 +245,19 @@ Installed with PHP. **Mac OS X** -Installed with PHP. + echo " SetHandler application/x-httpd-php " >> /usr/local/etc/apache2/2.4/httpd.conf ### Step 4: Install the Microsoft PHP Drivers for SQL Server + sudo pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system sudo pecl install sqlsrv sudo pecl install pdo_sqlsrv *Note: it installs the stable version, for specific version you should set the version. For example, `sudo pecl install sqlsrv-4.0.8`. Drivers are Mac-compatible starting from 4.1.7preview release. Do `sudo pecl search sqlsrv`. - - -### Step 5: Add the Microsoft PHP Drivers for SQL Server to php.ini - - echo "extension= sqlsrv.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` - echo "extension= pdo_sqlsrv.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` -### Step 6: Restart Apache to load the new php.ini file +### Step 5: Restart Apache to load the new php.ini file **Ubuntu** @@ -274,8 +273,8 @@ Drivers are Mac-compatible starting from 4.1.7preview release. Do `sudo pecl sea *Note to RedHat users: SELinux is installed by default and runs in Enforcing mode. To allow Apache to connect to database through SELinux, do this `sudo setsebool -P httpd_can_network_connect_db 1` -### Step 7: Create your sample app -Navigate to `/var/www/html` (`/Library/WebServer/Documents` on Mac) and create a new file called testsql.php. Copy and paste the following code in tetsql.php and change the servername, username, password and databasename. +### Step 6: Create your sample app +Navigate to `/var/www/html` (`/usr/local/var/www/htdocs` on Mac) and create a new file called testsql.php. Copy and paste the following code in tetsql.php and change the servername, username, password and databasename. -### Step 8: Run your sample app +### Step 7: Run your sample app Go to your browser and type in http://localhost/testsql.php You should be able to connect to your SQL Server/Azure SQL Database. From f76f604ef1161b8f5537de3135d0254a7f9f85d0 Mon Sep 17 00:00:00 2001 From: ulvii Date: Wed, 8 Mar 2017 17:04:27 -0800 Subject: [PATCH 21/24] Adding php7.1-xml installation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index df827d771..014b2b413 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac sudo su add-apt-repository ppa:ondrej/php apt-get update - apt-get -y install php7.1 mcrypt php7.1-mcrypt php-mbstring php-pear php7.1-dev + apt-get -y install php7.1 mcrypt php7.1-mcrypt php-mbstring php-pear php7.1-dev php7.1-xml **RedHat 7** From 42302cea13e4b98759d7d557a2cf5129f9a0d5fe Mon Sep 17 00:00:00 2001 From: ulvii Date: Wed, 8 Mar 2017 18:01:21 -0800 Subject: [PATCH 22/24] Apache config for Mac --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 014b2b413..a936b97d5 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac **Mac OS X** - echo " SetHandler application/x-httpd-php " >> /usr/local/etc/apache2/2.4/httpd.conf + {echo ""; echo "SetHandler application/x-httpd-php"; echo "";} >> /usr/local/etc/apache2/2.4/httpd.conf ####PHP 7.1 @@ -245,7 +245,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac **Mac OS X** - echo " SetHandler application/x-httpd-php " >> /usr/local/etc/apache2/2.4/httpd.conf + {echo ""; echo "SetHandler application/x-httpd-php"; echo "";} >> /usr/local/etc/apache2/2.4/httpd.conf ### Step 4: Install the Microsoft PHP Drivers for SQL Server From bba90a6e586cf6db66afda8e4a89e5bc6e694dfa Mon Sep 17 00:00:00 2001 From: ulvii Date: Fri, 10 Mar 2017 11:44:59 -0800 Subject: [PATCH 23/24] Fixing Apache config --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a936b97d5..ffdbf9821 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac **Mac OS X** - {echo ""; echo "SetHandler application/x-httpd-php"; echo "";} >> /usr/local/etc/apache2/2.4/httpd.conf + (echo ""; echo "SetHandler application/x-httpd-php"; echo "";) >> /usr/local/etc/apache2/2.4/httpd.conf ####PHP 7.1 @@ -245,7 +245,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac **Mac OS X** - {echo ""; echo "SetHandler application/x-httpd-php"; echo "";} >> /usr/local/etc/apache2/2.4/httpd.conf + (echo ""; echo "SetHandler application/x-httpd-php"; echo "";) >> /usr/local/etc/apache2/2.4/httpd.conf ### Step 4: Install the Microsoft PHP Drivers for SQL Server From 81d898d161ad598d67262870d6a5b62cc84c0b38 Mon Sep 17 00:00:00 2001 From: ulvii Date: Fri, 10 Mar 2017 13:11:59 -0800 Subject: [PATCH 24/24] Update PECL instructions --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ffdbf9821..0e2aa5121 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac brew install llvm --with-clang --with-clang-extra-tools brew install autoconf -*Note: You need to make sure you install PHP 7 before you proceed to step 2. The Microsoft PHP Drivers for SQL Server will only work for PHP 7+. +*Note: You need to make sure you install PHP 7 before you proceed to step 3. The Microsoft PHP Drivers for SQL Server will only work for PHP 7+. ### Step 3: Install Apache @@ -254,8 +254,8 @@ Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apac sudo pecl install sqlsrv sudo pecl install pdo_sqlsrv -*Note: it installs the stable version, for specific version you should set the version. For example, `sudo pecl install sqlsrv-4.0.8`. -Drivers are Mac-compatible starting from 4.1.7preview release. Do `sudo pecl search sqlsrv`. +*Note: it installs the stable version, for specific version you should set the version. For example, do `sudo pecl search sqlsrv` to search for the latest releases and `sudo pecl install sqlsrv-[version]` to install a specific version. +Drivers are Mac-compatible starting from 4.1.7preview release. . ### Step 5: Restart Apache to load the new php.ini file @@ -317,7 +317,7 @@ Navigate to `/var/www/html` (`/usr/local/var/www/htdocs` on Mac) and create a ne ### Step 7: Run your sample app -Go to your browser and type in http://localhost/testsql.php +Go to your browser and type in http://localhost/testsql.php (http://localhost:8080/testsql.php on Mac) You should be able to connect to your SQL Server/Azure SQL Database. The drivers are distributed as shared binary extensions for PHP. They are available in thread safe (*_ts.so) and-non thread safe (*_nts.so) versions. The source code for the drivers is also available, and you can choose whether to compile them as thread safe or non-thread safe versions. The thread safety configuration of your web server will determine which version you need.