简体   繁体   中英

Problem installing sqlsrv php extension in TurnKey GNU/Linux 9.11

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM