Question

do you have a tutorial to install the mssql library for php 7.1?

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). ?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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