Forked from andysnell/homestead_sqlsrv_driver_installer.sh
Created
January 17, 2017 22:18
-
-
Save jeremykenedy/f96ad57681b9212766ae55a0d7cc77e8 to your computer and use it in GitHub Desktop.
SQL Server Driver Installer for Laravel Homestead
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
#!/bin/bash | |
# SQL Server Driver Installer for Laravel Homestead | |
# | |
# This script downloads, compiles, and installs the PHP 7 extension | |
# files for both the native sqlsrv and the PDO pdo_sqlsrv drivers. | |
# Get the Microsoft Driver Source Code from Github | |
cd ~ | |
git clone https://github.com/Microsoft/msphpsql.git | |
cd msphpsql | |
git checkout PHP-7.0-Linux | |
# Run the ODBC Installer Script | |
sh ODBC\ install\ scripts/installodbc_ubuntu.sh | |
# Compile and Install the Native sqlsrv Driver | |
cd ~/msphpsql/source/sqlsrv | |
phpize && ./configure CXXFLAGS=-std=c++11 && make | |
sudo make install | |
sudo echo "extension=sqlsrv.so" | sudo tee /etc/php/7.0/mods-available/sqlsrv.ini | |
phpenmod sqlsrv | |
# Compile and Install the pdo_sqlsrv Driver | |
cd ~/msphpsql/source/pdo_sqlsrv | |
phpize && ./configure CXXFLAGS=-std=c++11 && make | |
sudo make install | |
sudo echo "extension=pdo_sqlsrv.so" | sudo tee /etc/php/7.0/mods-available/pdo_sqlsrv.ini | |
sudo phpenmod pdo_sqlsrv | |
# Restart the PHP-FPM Service | |
sudo systemctl restart php7.0-fpm.service | |
# Clean Up | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment