Skip to content

Instantly share code, notes, and snippets.

@georgecoca
Created October 7, 2016 11:58
Show Gist options
  • Save georgecoca/dbd81be25cc856ba8bbd7c384d84877e to your computer and use it in GitHub Desktop.
Save georgecoca/dbd81be25cc856ba8bbd7c384d84877e to your computer and use it in GitHub Desktop.
Install Microsoft drivers SQL SERVER for PHP 7 (PHP-FPM)
# Run as root
sudo su
# Change location
cd ~
# Install the unixODBC driver manager and Microsoft ODBC driver for Linux
wget https://raw.githubusercontent.com/Microsoft/msphpsql/PHP-7.0-Linux/ODBC%20install%20scripts/installodbc_ubuntu.sh
# Run installer
sh installodbc_ubuntu.sh
# Install PHP dependenceis
apt-get install php-pear php-dev
# Install sqlsrv (check last version with pecl search sqlsrv)
pecl install sqlsrv-4.0.5
# Install pdo_sqlsrv (check last version with pecl search sqlsrv)
pecl install pdo_sqlsrv-4.0.5
# Load extensions
echo "extension=sqlsrv.so" | sudo tee --append /etc/php/7.0/fpm/php.ini
echo "extension=pdo_sqlsrv.so" | sudo tee --append /etc/php/7.0/fpm/php.ini
# Restart PHP-FPM
service php7.0-fpm restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment