Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install sqlsrv ubuntu 18.04 php 7.2
apt-get install php7.2-dev php7.2-xml -y --allow-unauthenticated
sudo curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
sudo curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17 -y
sudo ACCEPT_EULA=Y apt-get install mssql-tools -y
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install unixodbc-dev -y
sudo apt-get install gcc g++ make autoconf libc-dev pkg-config -y
sudo printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/7.2/mods-available/sqlsrv.ini
sudo printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/7.2/mods-available/pdo_sqlsrv.ini
sudo phpenmod -v 7.2 sqlsrv pdo_sqlsrv
sudo apt-get install libapache2-mod-php7.2
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
sudo echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/pdo_sqlsrv.ini
sudo echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/sqlsrv.ini
sudo apt-get install php-pear -y
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment