Skip to content

Instantly share code, notes, and snippets.

@ijin82
Last active February 12, 2020 11:12
Show Gist options
  • Save ijin82/1f75fb2156347fa27cd07d9508228043 to your computer and use it in GitHub Desktop.
Save ijin82/1f75fb2156347fa27cd07d9508228043 to your computer and use it in GitHub Desktop.
extension=php_pdo_sqlsrv_73_nts.so
extension=php_sqlsrv_73_nts.so
#!/bin/bash
## switch php to 7.3 on homestead
#function php73() {
# sudo update-alternatives --set php /usr/bin/php7.3
# sudo update-alternatives --set php-config /usr/bin/php-config7.3
# sudo update-alternatives --set phpize /usr/bin/phpize7.3
#}
#php73
## additional requirements
sudo apt-get install unixodbc
# copy drivers
### Version 5.6.1 for php 7.3 & Ubuntu 18
### From: https://github.com/microsoft/msphpsql/releases/tag/v5.6.1
rm -f Ubuntu18-7.3.tar
wget https://github.com/microsoft/msphpsql/releases/download/v5.6.1/Ubuntu18-7.3.tar
tar --extract -v -f Ubuntu18-7.3.tar
rm -f Ubuntu18-7.3.tar
extensionPath=`php -r "echo ini_get('extension_dir');"`
sudo cp -v Ubuntu18-7.3/php_pdo_sqlsrv_73_nts.so $extensionPath/php_pdo_sqlsrv_73_nts.so
sudo cp -v Ubuntu18-7.3/php_sqlsrv_73_nts.so $extensionPath/php_sqlsrv_73_nts.so
rm -rf Ubuntu18-7.3
sudo cp -v 10-sqlsrv.ini /etc/php/7.3/cli/conf.d/10-sqlsrv.ini
sudo cp -v 10-sqlsrv.ini /etc/php/7.3/fpm/conf.d/10-sqlsrv.ini
# setup ODBC driver
wget https://packages.microsoft.com/ubuntu/18.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.4.2.1-1_amd64.deb
sudo ACCEPT_EULA=Y dpkg -i msodbcsql17_17.4.2.1-1_amd64.deb
rm msodbcsql17_17.4.2.1-1_amd64.deb
#sudo service php7.3-fpm restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment