PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 4, 2022

[FIXED] Problem installing sqlsrv php extension in TurnKey GNU/Linux 9.11

 January 04, 2022     lamp, odbc, php, sql-server     No comments   

Issue

I've try to install sqlsrv and pdo_sqlsrv extension for php in my LAMP server with command:

pecl install sqlsrv
pecl install pdo_sqlsrv

but fail with this error:

Makefile:204: recipe for target 'shared/core_stream.lo' failed
make: *** [shared/core_stream.lo] Error 1
ERROR: `make' failed

more details:

lsb_release -a
No LSB modules are available.
Distributor ID: TurnKey
Description:    TurnKey GNU/Linux 9.11 (stretch)
Release:        9.11
Codename:       stretch

odbcinst -j
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

odbcinst -q -d -n "ODBC Driver 13 for SQL Server"
[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2
UsageCount=1

thanks in advance for the help


Solution

ODBC Driver 13 for SQL Server that you trying to install is already outdated and doesn't fit to Debian 9 on which is based your Linux distribution.

You supposed to install ODBC Driver 17:

sudo su 
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -

curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list

exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
# optional: for bcp and sqlcmd
sudo 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
# optional: for unixODBC development headers
sudo apt-get install unixodbc-dev
# optional: kerberos library for debian-slim distributions
sudo apt-get install libgssapi-krb5-2

Above code is dedicated to Debian 9, and may not work on your system, but most probably will. Code came from: Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS



Answered By - A J
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing