Skip to content

Day 2 Solution


apt-get install update

add-apt-repository ppa:ondrej/php -y
apt-get update
apt-get install php7.2 php7.2-dev php7.2-xml -y –allow-unauthenticated

apt-get install gnupg gnupg2 gnupg1
curl | apt-key add –
curl > /etc/apt/sources.list.d/mssql-release.list

apt-get update
ACCEPT_EULA=Y apt-get install msodbcsql17
ACCEPT_EULA=Y apt-get install mssql-tools

echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bash_profile
echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bashrc
source ~/.bashrc

apt install -y unixodbc-utf16 unixodbc-dev-utf16 2> /dev/null
sudo apt-get install php-pear
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv

#had to modify the location

echo “” >> $phpini
echo “# Extensions for Microsoft SQL Server Driver” >> $phpini
echo “” >> $phpini
echo “” >> $phpini
echo “” >> $phpini

#I didn’t had CLI?!

#echo “” >> $phpini
#echo “# Extensions for Microsoft SQL Server Driver” >> $phpini
#echo “” >> $phpini
#echo “” >> $phpini
#echo “” >> $phpini

echo “Installing Microsoft ODBC Driver for SQL Server”

# Originally from:
apt install -y libc6 libstdc++6 libkrb5-3 libcurl3 openssl debconf unixodbc unixodbc-dev

#doesn’t work: $basedir is not set, but also none of the (sub)directories exist on my setup
#sudo ACCEPT_EULA=Y dpkg -i $basedir/config/php-extensions/mssql/bin/debs/current/*.deb

# Create symlinks for tools
#had to change the source filenames to sqlcmd and bcp because with - suffix the files were not found
ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd
ln -sfn /opt/mssql-tools/bin/bcp /usr/bin/bcp

service php7.2-fpm restart




Lets make sure that you have your SSL installed and updated:

Now lets fix the naming of the file by creating a link:

make sure that is loaded in 30-pdo_sqlsrv.ini instead of php.ini

debugging do ldd or any other .so files

Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *