execute these instructions, for php 7.1 on Ubuntu 18.04?

# INSTALL MSSQL 17
RUN sudo apt-get -y install curl
RUN sudo su
RUN curl -s https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN bash -c "curl -s https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list"
RUN exit
RUN sudo apt-get update && \
sudo ACCEPT_EULA=Y apt-get -y install msodbcsql17 && \
sudo ACCEPT_EULA=Y apt-get -y install mssql-tools && \
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile && \
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc && \
bash -c "source ~/.bashrc" && \
sudo apt-get -y install unixodbc-dev

######## INSTALL EXTENSION SQLSRV & PDO_SQLSRV ##########
RUN sudo apt-get -y install gcc g++ make autoconf libc-dev pkg-config && \
sudo apt-get -y install php7.1-dev && \
sudo apt-get -y install php-pear && \
pecl channel-update pecl.php.net && \
sudo pecl install sqlsrv && \
sudo pecl install pdo_sqlsrv && \
sudo su && \
bash -c "echo extension=sqlsrv.so > /etc/php/7.1/apache2/conf.d/20-sqlsrv.ini" && \
bash -c "echo extension=pdo_sqlsrv.so > /etc/php/7.1/apache2/conf.d/30-pdo_sqlsrv.ini" && \
exit

#bash -c "echo extension=sqlsrv.so > /etc/php/7.1/apache2/conf.d/20-sqlsrv.ini" && \
#bash -c "echo extension=pdo_sqlsrv.so > /etc/php/7.1/apache2/conf.d/30-pdo_sqlsrv.ini" && \

but it doesn’t work in digital ocean, there is something special with the Ubuntu iso (Digital ocean). ?

edited by kamaln7

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

This looks more or less correct. Are you getting any errors after the installation?

I would also suggest checking out the official instructions from the Microsoft documentation at:

https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15

Regards,
Bobby

Submit an Answer