直到几天前,这一点一直在起作用.我们正在使用以下代码构建一个停靠器容器,但这是在try "PECL INSTALL SQLSRV"时发生的错误.正在try 从此容器中的PHP连接到MSSQL服务器.有比我更聪明的人有什么 idea 吗?
杜克文件:
FROM --platform=linux/amd64 php:8.0-fpm
RUN apt-get update && apt-get -y install nano apt-utils libxml2-dev gnupg \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libzip-dev \
&& docker-php-ext-install zip
RUN apt-get -y install libicu-dev gcc g++ make autoconf libc-dev pkg-config libssl-dev apt-transport-https libgss3
# Install MS ODBC Driver for SQL Server
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update
# Automatically accept the terms from Microsoft
RUN apt-get install -y unixodbc unixodbc-dev odbcinst locales
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17
RUN apt-get -y install gcc g++ make autoconf libc-dev pkg-config
RUN apt-get update
RUN pecl install sqlsrv
RUN pecl install pdo_sqlsrv
RUN docker-php-ext-enable sqlsrv pdo_sqlsrv
错误:
#0 41.16 In file included from /usr/include/sql.h:19,
#0 41.16 from /tmp/pear/temp/sqlsrv/shared/xplat.h:30,
#0 41.16 from /tmp/pear/temp/sqlsrv/shared/typedefs_for_linux.h:23,
#0 41.16 from /tmp/pear/temp/sqlsrv/shared/xplat_winnls.h:24,
#0 41.16 from /tmp/pear/temp/sqlsrv/shared/FormattedPrint.h:24,
#0 41.16 from /tmp/pear/temp/sqlsrv/shared/core_sqlsrv.h:41,
#0 41.16 from /tmp/pear/temp/sqlsrv/php_sqlsrv_int.h:25,
#0 41.16 from /tmp/pear/temp/sqlsrv/conn.cpp:24:
#0 41.16 /usr/include/sqltypes.h:56:10: fatal error: unixodbc.h: No such file or directory
#0 41.16 56 | #include "unixodbc.h"
#0 41.16 | ^~~~~~~~~~~~
#0 41.16 compilation terminated.
#0 41.18 make: *** [Makefile:209: conn.lo] Error 1
#0 41.19 ERROR: `make' failed
我已经try 了从7.0到8.1的所有版本的PHP,有没有带FPM的都有.我还try 了msodbcsql和unixodbc/unixodbc-dev的几个版本,以及sqlsrv和pdo_sqlsrv的几个版本.