Forked from jeremykenedy/homestead_sqlsrv_driver_installer.sh
Created
July 29, 2019 02:28
-
-
Save lloricode/2c464cc2fd88fb5b0b47795c9bc152dd to your computer and use it in GitHub Desktop.
SQL Server Driver Installer for Laravel Homestead
This file contains hidden or 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