Ultimate guide to install PHP 7.2 MS SQL drivers on Ubuntu

///Ultimate guide to install PHP 7.2 MS SQL drivers on Ubuntu

Ultimate guide to install PHP 7.2 MS SQL drivers on Ubuntu

Hi There,

It seems to me that there is not a definitive guide to install MS SQL (Microsoft’s PHP MS SQL drivers) on Ubuntu, so here is the 20 steps:

  1. Install Ubuntu (tested on 16.04 LTS)
  2. sudo -s
  3. curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
  4. curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
  5. apt-get update
  6. ACCEPT_EULA=Y apt-get install msodbcsql17
  7. apt-get install unixodbc-dev
  8. add-apt-repository ppa:ondrej/php
  9. apt-get update
  10. apt-get install php7.2 php-dev php-xml php-pearĀ 
  11. echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini
  12. echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-sqlsrv.ini
  13. pecl install sqlsrv
  14. pecl install pdo_sqlsrv
  15. a2dismod mpm_event
  16. a2enmod mpm_prefork
  17. a2enmod php7.2
  18. echo "extension=sqlsrv.so" >> /etc/php/7.2/apache2/php.ini
  19. echo "extension=pdo_sqlsrv.so" >> /etc/php/7.2/apache2/php.ini
  20. service apache2 restart
By |2018-05-08T22:55:48+00:00May 8th, 2018|Apache, Linux|0 Comments

Leave A Comment