You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Linux-mac-install.md
+42-32Lines changed: 42 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,39 +1,37 @@
1
1
# Linux and macOS Installation Tutorial for the Microsoft Drivers for PHP for SQL Server
2
-
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.12and 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).
2
+
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).
3
3
4
4
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.
5
5
6
6
## Contents of this page:
7
7
8
-
-[Installing the drivers on Ubuntu 16.04, 18.04 and 18.10](#installing-the-drivers-on-ubuntu-1604-1804-and-1810)
8
+
-[Installing the drivers on Ubuntu 16.04, 18.04, and 18.10](#installing-the-drivers-on-ubuntu-1604-1804-and-1810)
9
9
-[Installing the drivers on Red Hat 7](#installing-the-drivers-on-red-hat-7)
10
10
-[Installing the drivers on Debian 8 and 9](#installing-the-drivers-on-debian-8-and-9)
11
11
-[Installing the drivers on Suse 12](#installing-the-drivers-on-suse-12)
12
-
-[Installing the drivers on macOS El Capitan, Sierra, High Sierra and Mojave](#installing-the-drivers-on-macos-el-capitan-sierra-high-sierra-and-mojave)
12
+
-[Installing the drivers on macOS El Capitan, Sierra, High Sierra, and Mojave](#installing-the-drivers-on-macos-el-capitan-sierra-high-sierra-and-mojave)
13
13
14
-
## Installing the drivers on Ubuntu 16.04, 18.04 and 18.10
14
+
## Installing the drivers on Ubuntu 16.04, 18.04, and 18.10
15
15
16
16
> [!NOTE]
17
-
> To install PHP 7.0 or 7.1, replace 7.2 with 7.0 or 7.1 in the following commands.
18
-
> For Ubuntu 18.04, the step to add the ondrej repository is not required unless
19
-
> PHP 7.0 or 7.1 is needed. However, installing PHP 7.0 or 7.1 in Ubuntu 18.04 or 18.10
20
-
> may not work as packages from the ondrej repository come with dependencies that may
21
-
> conflict with a base Ubuntu 18.04 or 18.10 install.
17
+
> 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.
22
18
23
19
### Step 1. Install PHP
24
20
```
25
21
sudo su
26
-
# The following step is required for Ubuntu 16.04 only
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).
27
+
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).
33
28
34
-
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/en-us/download/details.aspx?id=57341).
29
+
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).
35
30
36
31
### Step 3. Install the PHP drivers for Microsoft SQL Server
32
+
33
+
> [!NOTE]
34
+
> 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.
37
35
```
38
36
sudo pecl install sqlsrv
39
37
sudo pecl install pdo_sqlsrv
@@ -62,22 +60,23 @@ To test your installation, see [Testing your installation](#testing-your-install
62
60
## Installing the drivers on Red Hat 7
63
61
64
62
> [!NOTE]
65
-
> To install PHP 7.0or 7.1, replace remi-php72 with remi-php70or remi-php71 respectively in the following commands.
63
+
> 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.
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).
79
+
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).
81
80
82
81
Compiling the PHP drivers with PECL with PHP 7.2 requires a more recent GCC than the default:
83
82
```
@@ -86,6 +85,9 @@ sudo yum install devtoolset-7
86
85
scl enable devtoolset-7 bash
87
86
```
88
87
### Step 3. Install the PHP drivers for Microsoft SQL Server
88
+
89
+
> [!NOTE]
90
+
> 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.
89
91
```
90
92
sudo pecl install sqlsrv
91
93
sudo pecl install pdo_sqlsrv
@@ -106,7 +108,7 @@ sudo make install
106
108
```
107
109
You can alternatively download the prebuilt binaries from the [Github project page](https://github.com/Microsoft/msphpsql/releases), or install from the Remi repo:
108
110
```
109
-
sudo yum install php-sqlsrv php-pdo_sqlsrv
111
+
sudo yum install php-sqlsrv
110
112
```
111
113
### Step 4. Install Apache
112
114
```
@@ -125,7 +127,7 @@ To test your installation, see [Testing your installation](#testing-your-install
125
127
## Installing the drivers on Debian 8 and 9
126
128
127
129
> [!NOTE]
128
-
> To install PHP 7.0or 7.1, replace 7.2 in the following commands with 7.0or 7.1.
130
+
> 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.
129
131
130
132
### Step 1. Install PHP
131
133
```
@@ -137,7 +139,7 @@ apt-get update
137
139
apt-get install -y php7.2 php7.2-dev php7.2-xml
138
140
```
139
141
### Step 2. Install prerequisites
140
-
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).
142
+
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).
141
143
142
144
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:
143
145
```
@@ -147,6 +149,9 @@ locale-gen
147
149
```
148
150
149
151
### Step 3. Install the PHP drivers for Microsoft SQL Server
152
+
153
+
> [!NOTE]
154
+
> 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.
150
155
```
151
156
sudo pecl install sqlsrv
152
157
sudo pecl install pdo_sqlsrv
@@ -174,21 +179,24 @@ To test your installation, see [Testing your installation](#testing-your-install
174
179
## Installing the drivers on Suse 12
175
180
176
181
> [!NOTE]
177
-
> To install PHP 7.0, skip the command below adding the repository - 7.0 is the default PHP on suse 12.
178
-
> To install PHP 7.1, replace the repository URL below with the following URL:
zypper -n ar -f http://download.opensuse.org/repositories/devel:languages:php/SLE_12/devel:languages:php.repo
189
+
zypper -n ar -f https://download.opensuse.org/repositories/devel:languages:php/SLE_12_SP3/devel:languages:php.repo
185
190
zypper --gpg-auto-import-keys refresh
186
191
zypper -n install php7 php7-pear php7-devel
187
192
```
188
193
### Step 2. Install prerequisites
189
-
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).
194
+
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).
190
195
191
196
### Step 3. Install the PHP drivers for Microsoft SQL Server
197
+
198
+
> [!NOTE]
199
+
> 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.
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:
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).
246
+
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).
241
247
242
248
In addition, you may need to install the GNU make tools:
243
249
```
244
250
brew install autoconf automake libtool
245
251
```
246
252
247
253
### Step 3. Install the PHP drivers for Microsoft SQL Server
254
+
255
+
> [!NOTE]
256
+
> 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.
@@ -320,4 +329,5 @@ function formatErrors($errors)
320
329
}
321
330
?>
322
331
```
323
-
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.
332
+
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.
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,8 +45,8 @@ Thank you for taking the time to participate in our last survey. You can continu
45
45
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.
46
46
47
47
On the client machine:
48
-
- PHP 7.1.x, or 7.2.x (7.2.0 and up on Unix, 7.2.1 and up on Windows)
49
-
-[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)
48
+
- 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
49
+
-[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)
50
50
- If using a Web server such as Internet Information Services (IIS) or Apache, it must be configured to run PHP
51
51
52
52
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.
0 commit comments