diff --git a/README.md b/README.md index 6c9c2aeb..f877f5b3 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Thank you for taking time to take our February 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) +* [**SUSE + SQL Server + PHP 7**](https://www.microsoft.com/en-us/sql-server/developer-get-started/php/sles) * [**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/) @@ -80,7 +81,7 @@ This software has been compiled and tested under PHP 7.0.20 and 7.1.6 using the 3. Restart the Web server. ## Install (UNIX) -The following instructions assume a clean environment and show how to install PHP 7.x, Microsoft ODBC driver, apache, and Microsoft PHP drivers on Ubuntu 15, 16, RedHat 7, Debian 8, and Mac OS X. +The following instructions assume a clean environment and show how to install PHP 7.x, Microsoft ODBC driver, Apache, and Microsoft PHP drivers on Ubuntu 15, 16, RedHat 7, Debian 8, SUSE 12, and macOS. ### Step 1: Install PHP7+ @@ -120,7 +121,13 @@ The following instructions assume a clean environment and show how to install PH apt-get update apt-get install -y php7.0 php-pear php7.0-dev php7.0-xml -**Mac OS X** +**SUSE 12** + + sudo su + zypper refresh + zypper install -y php7 php7-pear php7-devel + +**macOS** /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew tap @@ -163,7 +170,14 @@ Note that there are no PHP 7.1 packages available for Ubuntu 15.10. apt-get update apt-get install -y php7.1 php-pear php7.1-dev php7.1-xml -**Mac OS X** +**SUSE 12** + + sudo su + zypper -n ar -f http://download.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_42.3/ devel:languages:php + zypper --gpg-auto-import-keys refresh + zypper -n install php7 php7-pear php7-devel + +**macOS** /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew tap @@ -230,7 +244,20 @@ Note that there are no PHP 7.1 packages available for Ubuntu 15.10. sudo ACCEPT_EULA=Y apt-get install msodbcsql sudo apt-get install unixodbc-dev -**Mac OS X** +**SUSE 12** + + sudo su + zypper ar https://packages.microsoft.com/config/sles/12/prod.repo + sudo zypper --gpg-auto-import-keys refresh + exit + sudo ACCEPT_EULA=Y zypper install msodbcsql + sudo ACCEPT_EULA=Y zypper install mssql-tools + sudo zypper install unixODBC-devel + echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile + echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc + source ~/.bashrc + +**macOS** brew tap microsoft/msodbcsql https://github.com/Microsoft/homebrew-mssql-release brew update @@ -244,7 +271,7 @@ Note that there are no PHP 7.1 packages available for Ubuntu 15.10. *Note: You can run `sudo pecl search sqlsrv` to search for the latest releases and `sudo pecl install sqlsrv-[version]` to install a specific version. PECL installs the stable version when version is not specified. Drivers are Mac-compatible starting from `4.1.7preview` release. -On Ubuntu and Debian systems only, run: +On Ubuntu, Debian, and SUSE systems only, run: sudo pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system @@ -274,7 +301,15 @@ On all systems, run: echo "extension=sqlsrv.so" > /etc/php.d/sqlsrv.ini echo "extension=pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini -**Mac OS X** +**SUSE** + + sudo su + zypper install apache2 apache2-mod_php7 + a2enmod php7 + echo "extension=sqlsrv.so" >> /etc/php7/apache2/php.ini + echo "extension=pdo_sqlsrv.so" >> /etc/php7/apache2/php.ini + +**macOS** (echo ""; echo "SetHandler application/x-httpd-php"; echo "";) >> /usr/local/etc/apache2/2.4/httpd.conf @@ -297,14 +332,22 @@ On all systems, run: echo "extension=sqlsrv.so" > /etc/php.d/sqlsrv.ini echo "extension=pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini -**Mac OS X** +**SUSE** + + sudo su + zypper install apache2 apache2-mod_php7 + a2enmod php7 + echo "extension=sqlsrv.so" >> /etc/php7/apache2/php.ini + echo "extension=pdo_sqlsrv.so" >> /etc/php7/apache2/php.ini + +**macOS** (echo ""; echo "SetHandler application/x-httpd-php"; echo "";) >> /usr/local/etc/apache2/2.4/httpd.conf ### Step 5: Restart Apache to load the new php.ini file -**Ubuntu and Debian** +**Ubuntu, Debian, and SUSE** sudo systemctl restart apache2 @@ -316,13 +359,13 @@ Note: On RedHat, SELinux is installed by default and runs in Enforcing mode. To sudo setsebool -P httpd_can_network_connect_db 1 -**Mac OS X** +**macOS** sudo apachectl restart ### 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 into testsql.php and change the servername, username, password and databasename. +Navigate to your system's document root -- `/var/www/html` on Ubuntu, Debian, and Redhat, `/srv/www/htdocs` on SUSE, or `/usr/local/var/www/htdocs` on Mac. Create a new file called testsql.php. Copy and paste the following code into testsql.php and change the servername, username, password and databasename.