Skip to content

Commit 4af55d5

Browse files
authored
Updated Linux and mac instructions (#1295)
1 parent 142ca11 commit 4af55d5

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

CHANGELOG.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Updated PECL release packages. Here is the list of updates:
88

99
### Added
1010
- Support for PHP 8.1 RC 1
11-
- Support for Ubuntu 21.04
11+
- Support for Ubuntu 21.04 and Alpine 3.13
1212
- Support for Apple M1 ARM64 hardware (requires [MS ODBC Driver 17.8+](https://docs.microsoft.com/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver15)
13-
- Feature Request [#795](https://github.com/microsoft/msphpsql/issues/795) - adding support for Table-valued parameters
13+
- Feature Request [#795](https://github.com/microsoft/msphpsql/issues/795) - adding support for [Table-valued parameters](https://github.com/Microsoft/msphpsql/wiki/Features#tvp)
1414

1515
### Removed
1616
- Support for Ubuntu 16.04
@@ -20,9 +20,8 @@ Updated PECL release packages. Here is the list of updates:
2020
- Pull request [#1251](https://github.com/microsoft/msphpsql/pull/1251) - simplified implementations of last insert id and quote
2121
- Issue [#1258](https://github.com/microsoft/msphpsql/issues/1258) - updated pdo_sqlsrv_get_driver_methods as per documentation - pull request [#1259](https://github.com/microsoft/msphpsql/pull/1259)
2222
- Pull request [#1260](https://github.com/microsoft/msphpsql/pull/1260) - cleaned up redundant code
23-
- Pull request [#1262](https://github.com/microsoft/msphpsql/pull/1262) - simplified parse_param_array in sqlsrv
24-
- Pull request [#1262](https://github.com/microsoft/msphpsql/pull/1262) - simplified parse_param_array in sqlsrv
2523
- Issue [#1261](https://github.com/microsoft/msphpsql/issues/1261) - simplified get_field_as_string and made it more robust - pull request [#1265](https://github.com/microsoft/msphpsql/pull/1265)
24+
- Pull request [#1262](https://github.com/microsoft/msphpsql/pull/1262) - simplified parse_param_array in sqlsrv
2625
- Pull request [#1267](https://github.com/microsoft/msphpsql/pull/1267) - replaced the obsolete MACRO ZVAL_NEW_ARR with array_init
2726
- Pull request [#1275](https://github.com/microsoft/msphpsql/pull/1275) - fixed warning compiling core_stmt.cpp by mlocati
2827
- Pull request [#1288](https://github.com/microsoft/msphpsql/pull/1288) - applied mask to pdo quote for binary inputs

Linux-mac-install.md

+31-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 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 8.0, the Microsoft ODBC driver, the Apache web server, and the Microsoft Drivers for PHP for SQL Server on Ubuntu 16.04, 18.04, and 20.04, RedHat 7 and 8, Debian 9 and 10, Suse 12 and 15, Alpine 3.11 and 3.12, and macOS 10.14, 10.15, and 11.0. 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#loading-the-driver-at-php-startup).
2+
The following instructions assume a clean environment and show how to install PHP 8.0, the Microsoft ODBC driver, the Apache web server, and the Microsoft Drivers for PHP for SQL Server on Ubuntu, RedHat, Debian, Suse, Alpine, and macOS. 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#loading-the-driver-at-php-startup).
33

44
The following instructions install PHP 8.0 by default using `pecl install`, if the PHP 8.0 packages are available. You may need to run `pecl channel-update pecl.php.net` first. Note that some supported Linux distros default to PHP 7.1 or earlier, which is not supported for the latest version of the PHP drivers for SQL Server -- please see the notes at the beginning of each section to install PHP 7.4 or 7.3 instead.
55

@@ -9,15 +9,15 @@ While these instructions contain commands to install both SQLSRV and PDO_SQLSRV
99

1010
## Contents of this page
1111

12-
- [Installing the drivers on Ubuntu 16.04, 18.04, and 20.04](#installing-the-drivers-on-ubuntu-1604-1804-and-2004)
12+
- [Installing the drivers on Ubuntu](#installing-the-drivers-on-ubuntu)
1313
- [Installing the drivers with PHP-FPM on Ubuntu](#installing-the-drivers-with-php-fpm-on-ubuntu)
14-
- [Installing the drivers on Red Hat 7 and 8](#installing-the-drivers-on-red-hat-7-and-8)
15-
- [Installing the drivers on Debian 9 and 10](#installing-the-drivers-on-debian-9-and-10)
16-
- [Installing the drivers on Suse 12 and 15](#installing-the-drivers-on-suse-12-and-15)
17-
- [Installing the drivers on Alpine 3.11 and 3.12](#installing-the-drivers-on-alpine-311-and-312)
18-
- [Installing the drivers on macOS Mojave, Catalina and Big Sur](#installing-the-drivers-on-macos-mojave-catalina-and-big-sur)
14+
- [Installing the drivers on Red Hat](#installing-the-drivers-on-red-hat)
15+
- [Installing the drivers on Debian](#installing-the-drivers-on-debian)
16+
- [Installing the drivers on Suse](#installing-the-drivers-on-suse)
17+
- [Installing the drivers on Alpine](#installing-the-drivers-on-alpine)
18+
- [Installing the drivers on macOS](#installing-the-drivers-on-macos)
1919

20-
## Installing the drivers on Ubuntu 16.04, 18.04, and 20.04
20+
## Installing the drivers on Ubuntu
2121

2222
> [!NOTE]
2323
> To install PHP 7.4 or 7.3, replace 8.0 with 7.4 or 7.3 in the following commands.
@@ -127,7 +127,7 @@ sudo systemctl restart nginx.service
127127
```
128128
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document.
129129

130-
## Installing the drivers on Red Hat 7 and 8
130+
## Installing the drivers on Red Hat
131131

132132
### Step 1. Install PHP
133133

@@ -193,7 +193,7 @@ sudo apachectl restart
193193
```
194194
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document.
195195

196-
## Installing the drivers on Debian 9 and 10
196+
## Installing the drivers on Debian
197197

198198
> [!NOTE]
199199
> To install PHP 7.4 or 7.3, replace 8.0 in the following commands with 7.4 or 7.3.
@@ -245,7 +245,7 @@ sudo service apache2 restart
245245
```
246246
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document.
247247

248-
## Installing the drivers on Suse 12 and 15
248+
## Installing the drivers on Suse
249249

250250
> [!NOTE]
251251
> In the following instructions, replace `<SuseVersion>` with your version of Suse - if you are using Suse Enterprise Linux 15, it will be SLE_15_SP1 or SLE_15_SP2. For Suse 12, use SLE_12_SP4 (or above if applicable). Not all versions of PHP are available for all versions of Suse Linux - please refer to `http://download.opensuse.org/repositories/devel:/languages:/php` to see which versions of Suse have the default version PHP available, or check `http://download.opensuse.org/repositories/devel:/languages:/php:/` to see which other versions of PHP are available for which versions of Suse.
@@ -292,7 +292,7 @@ sudo systemctl restart apache2
292292
```
293293
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document.
294294

295-
## Installing the drivers on Alpine 3.11 and 3.12
295+
## Installing the drivers on Alpine
296296

297297
> [!NOTE]
298298
> The default version of PHP is 7.3. PHP 7.4 or above may be available from testing or edge repositories for Alpine. You can instead compile PHP from source.
@@ -332,13 +332,16 @@ sudo rc-service apache2 restart
332332
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document.
333333

334334

335-
## Installing the drivers on macOS Mojave, Catalina and Big Sur
335+
## Installing the drivers on macOS
336336

337-
If you do not already have it, install brew as follows:
337+
If you do not already have it, install Homebrew as follows:
338338
```bash
339339
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
340340
```
341341

342+
> [!NOTE]
343+
> If using Apple M1 ARM64 hardware, please install Homebrew and PHP directly without using the emulator Rosetta 2.
344+
342345
> [!NOTE]
343346
> To install PHP 7.4 or 7.3, replace [email protected] with [email protected] or [email protected] respectively in the following commands.
344347
@@ -358,6 +361,9 @@ brew link --force --overwrite [email protected]
358361
Install the ODBC driver for macOS by following the instructions on the [Install the Microsoft ODBC driver for SQL Server (macOS)](
359362
https://docs.microsoft.com/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver15).
360363

364+
> [!NOTE]
365+
> If using Apple M1 ARM64 hardware, please install Microsoft ODBC driver 17.8+ directly without using the emulator Rosetta 2.
366+
361367
In addition, you may need to install the GNU make tools:
362368
```bash
363369
brew install autoconf automake libtool
@@ -368,7 +374,18 @@ brew install autoconf automake libtool
368374
sudo pecl install sqlsrv
369375
sudo pecl install pdo_sqlsrv
370376
```
377+
378+
If using Apple M1 ARM64, do the following instead:
379+
```bash
380+
sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install sqlsrv
381+
sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install pdo_sqlsrv
382+
```
383+
371384
### Step 4. Install Apache and configure driver loading
385+
386+
> [!NOTE]
387+
> The latest macOS 11.0 Big Sur comes with Apache 2.4 pre-installed, but Apple has also removed some required scripts. The solution is to install Apache 2.4 via Homebrew and then configure it, but this is out of scope for this installation guide, so please check Apache or Homebrew for detailed instructions.
388+
372389
```bash
373390
brew install apache2
374391
```

0 commit comments

Comments
 (0)