-
-
Save jgaydos/0aecbb66a0689c182daaddd8730ff3a8 to your computer and use it in GitHub Desktop.
| #!/bin/bash | |
| #ubuntu 18.04 | |
| #php7.3 | |
| # install php ppa | |
| apt -y install software-properties-common | |
| add-apt-repository ppa:ondrej/php -y | |
| apt update | |
| # install php w/o apache | |
| apt -y install php7.3-cli php7.3-mbstring php-pear php7.3-dev php7.3-curl php7.3-gd php7.3-zip php7.3-xml | |
| # install sqlcmd | |
| curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - | |
| curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | tee /etc/apt/sources.list.d/mssql-tools.list | |
| apt update | |
| ACCEPT_EULA=Y apt -y install msodbcsql17 | |
| echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile | |
| echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc | |
| source ~/.bashrc | |
| apt -y install unixodbc-dev | |
| # install sqlsrv driver | |
| # if this fails install sqlsrv-5.5.0preview & pdo_sqlsrv-5.5.0preview | |
| pecl install sqlsrv pdo_sqlsrv | |
| printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/7.3/mods-available/sqlsrv.ini | |
| printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/7.3/mods-available/pdo_sqlsrv.ini | |
| phpenmod -v 7.3 sqlsrv pdo_sqlsrv |
Setting and updating the alternatives then uninstall sqlsrv/pdo_sqlsrv then reinstalling seemed to work. Thank you.
@torressam333 Glad I could help. PHP drivers can be a royal a pain.
@jgaydos is there an easy way to also install sqlsrv on php5.6?
@torressam333 Ehh it has been quite some time since I have touched any PHP5.6 code. From what I remember this using FreeTDS looks familiar.
Super helpful, thank you.
Thank you for that @jgaydos. You saved me after 4 hours of searching for the fix to pecl.
Hola! me pueden indicar como o donde buscar info para isntalar varias instancias de sqlserver en un mismo servidor por favor?
graciaS!!
@ale-softplace I had to Google Translate, so forgive me if I did not understand your question properly. If you are trying to install multiple instances of MS SQL Server then that is only available on Windows, and not Linux (Source).
thanks!!
@torressam333 That looks correct. If the extensions you installed earlier are still installed you will need to uninstall them (
pecl uninstall sqlsrv pdo_sqlsrv). I would then rerun thepecl install sqlsrv pdo_sqlsrvand fingers crossed it works.