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). ?
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!
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:
Regards, Bobby
Something like that should do the trick as well
# Update package list
sudo apt-get update
# Install required packages
sudo apt-get install -y curl apt-transport-https
# Import the Microsoft GPG key
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Add Microsoft SQL Server Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
# Update package list again after adding the Microsoft repository
sudo apt-get update
# Install the required dependencies for PHP and SQL Server
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev
# Install PHP dev package for building extensions
sudo apt-get install -y php7.1-dev
# Install the PHP-pear package
sudo apt-get install -y php-pear
# Install the necessary extension for PHP to communicate with MSSQL
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
# Add the extensions to PHP configuration
echo "extension=sqlsrv.so" | sudo tee /etc/php/7.1/mods-available/sqlsrv.ini
echo "extension=pdo_sqlsrv.so" | sudo tee /etc/php/7.1/mods-available/pdo_sqlsrv.ini
# Enable the extensions for PHP 7.1
sudo phpenmod sqlsrv pdo_sqlsrv
# Restart the web server to apply changes (if you're using Apache)
sudo systemctl restart apache2
# Alternatively, restart PHP-FPM if you're using it
sudo systemctl restart php7.1-fpm
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.