-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Linux and mac instructions (#1295)
- Loading branch information
Showing
2 changed files
with
34 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# 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 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). | ||
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). | ||
|
||
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. | ||
|
||
|
@@ -9,15 +9,15 @@ While these instructions contain commands to install both SQLSRV and PDO_SQLSRV | |
|
||
## Contents of this page | ||
|
||
- [Installing the drivers on Ubuntu 16.04, 18.04, and 20.04](#installing-the-drivers-on-ubuntu-1604-1804-and-2004) | ||
- [Installing the drivers on Ubuntu](#installing-the-drivers-on-ubuntu) | ||
- [Installing the drivers with PHP-FPM on Ubuntu](#installing-the-drivers-with-php-fpm-on-ubuntu) | ||
- [Installing the drivers on Red Hat 7 and 8](#installing-the-drivers-on-red-hat-7-and-8) | ||
- [Installing the drivers on Debian 9 and 10](#installing-the-drivers-on-debian-9-and-10) | ||
- [Installing the drivers on Suse 12 and 15](#installing-the-drivers-on-suse-12-and-15) | ||
- [Installing the drivers on Alpine 3.11 and 3.12](#installing-the-drivers-on-alpine-311-and-312) | ||
- [Installing the drivers on macOS Mojave, Catalina and Big Sur](#installing-the-drivers-on-macos-mojave-catalina-and-big-sur) | ||
- [Installing the drivers on Red Hat](#installing-the-drivers-on-red-hat) | ||
- [Installing the drivers on Debian](#installing-the-drivers-on-debian) | ||
- [Installing the drivers on Suse](#installing-the-drivers-on-suse) | ||
- [Installing the drivers on Alpine](#installing-the-drivers-on-alpine) | ||
- [Installing the drivers on macOS](#installing-the-drivers-on-macos) | ||
|
||
## Installing the drivers on Ubuntu 16.04, 18.04, and 20.04 | ||
## Installing the drivers on Ubuntu | ||
|
||
> [!NOTE] | ||
> 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 | |
``` | ||
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document. | ||
|
||
## Installing the drivers on Red Hat 7 and 8 | ||
## Installing the drivers on Red Hat | ||
|
||
### Step 1. Install PHP | ||
|
||
|
@@ -193,7 +193,7 @@ sudo apachectl restart | |
``` | ||
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document. | ||
|
||
## Installing the drivers on Debian 9 and 10 | ||
## Installing the drivers on Debian | ||
|
||
> [!NOTE] | ||
> 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 | |
``` | ||
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document. | ||
|
||
## Installing the drivers on Suse 12 and 15 | ||
## Installing the drivers on Suse | ||
|
||
> [!NOTE] | ||
> 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 | |
``` | ||
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document. | ||
|
||
## Installing the drivers on Alpine 3.11 and 3.12 | ||
## Installing the drivers on Alpine | ||
|
||
> [!NOTE] | ||
> 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 | |
To test your installation, see [Testing your installation](#testing-your-installation) at the end of this document. | ||
|
||
|
||
## Installing the drivers on macOS Mojave, Catalina and Big Sur | ||
## Installing the drivers on macOS | ||
|
||
If you do not already have it, install brew as follows: | ||
If you do not already have it, install Homebrew as follows: | ||
```bash | ||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | ||
``` | ||
|
||
> [!NOTE] | ||
> If using Apple M1 ARM64 hardware, please install Homebrew and PHP directly without using the emulator Rosetta 2. | ||
> [!NOTE] | ||
> To install PHP 7.4 or 7.3, replace [email protected] with [email protected] or [email protected] respectively in the following commands. | ||
|
@@ -358,6 +361,9 @@ brew link --force --overwrite [email protected] | |
Install the ODBC driver for macOS by following the instructions on the [Install the Microsoft ODBC driver for SQL Server (macOS)]( | ||
https://docs.microsoft.com/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver15). | ||
|
||
> [!NOTE] | ||
> If using Apple M1 ARM64 hardware, please install Microsoft ODBC driver 17.8+ directly without using the emulator Rosetta 2. | ||
In addition, you may need to install the GNU make tools: | ||
```bash | ||
brew install autoconf automake libtool | ||
|
@@ -368,7 +374,18 @@ brew install autoconf automake libtool | |
sudo pecl install sqlsrv | ||
sudo pecl install pdo_sqlsrv | ||
``` | ||
|
||
If using Apple M1 ARM64, do the following instead: | ||
```bash | ||
sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install sqlsrv | ||
sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install pdo_sqlsrv | ||
``` | ||
|
||
### Step 4. Install Apache and configure driver loading | ||
|
||
> [!NOTE] | ||
> 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. | ||
```bash | ||
brew install apache2 | ||
``` | ||
|