Closed
Description
The installation of the odbc php extension fails.
FROM php:5.6-fpm
MAINTAINER "Austin Maddox" <###@###.com>
RUN docker-php-ext-install odbc
Results in...
Sending build context to Docker daemon 6.276 MB
Sending build context to Docker daemon
Step 0 : FROM php:5.6-fpm
---> 6e868825957f
Step 1 : MAINTAINER "Austin Maddox" <###@###.com>
---> Using cache
---> 481c0cc76869
Step 2 : RUN docker-php-ext-install odbc
---> Running in fa4294a61b70
+ cd /usr/src/php/ext/odbc
+ phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
+ ./configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20131226
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for Adabas support... cp: cannot stat '/usr/local/lib/odbclib.a': No such file or directory
configure: error: ODBC header file '/usr/local/incl/sqlext.h' not found!
Removing intermediate container fa4294a61b70
INFO[0002] The command [/bin/sh -c docker-php-ext-install odbc] returned a non-zero code: 1
Is there something I'm missing? Is there a package dependency that needs to be installed first or something? I've tried installing php5-odbc, unixODBC, unixODBC-dev and nothing helps.
Activity
md5 commentedon May 28, 2015
It looks like you'll want to install
unixODBC-dev
and set--with-unixODBC[=DIR]
, per these docs: http://php.net/manual/en/odbc.installation.phpI'm not sure what
=DIR
should be set to, but you can probably figure out out withdpkg
orfind
.AustinMaddox commentedon May 28, 2015
I've tried something like that...
RUN apt-get update && apt-get install -y \ unixodbc-dev RUN docker-php-ext-configure odbc --with-unixODBC RUN docker-php-ext-install \ odbc
I'm also not sure what
=DIR
should be set to. How would I usedpkg
orfind
to figure that out?tianon commentedon May 28, 2015
I've been hammering my head on this one for at least 30 minutes, and I've found something interesting in the compiled
configure
script:test "$PHP_ADABAS" = "no" && PHP_ADABAS=yes
If
PHP_ADABAS
is disabled, force it to be enabled??? WATmd5 commentedon May 28, 2015
I think
=DIR
should just be/usr
. I useddpkg -L unixodbc-dev
to see where the files were installed. I'm not sure about the Adabas failure, though.tianon commentedon May 28, 2015
Yeah, I've been hacking at it for a while (and @yosifkit tried too) and Adabas screws it up every single way we try (
./configure --with-unixODBC=shared,/usr
,./configure --with-unixODBC=/usr
,./configure --with-unixODBC=/usr --with-adabas=no
, etc ad nauseum).md5 commentedon May 28, 2015
https://bugs.php.net/bug.php?id=66185
tianon commentedon May 28, 2015
tianon commentedon May 28, 2015
So, the generated
./configure
script has a number of thosetest "$PHP_XXX" = "no" && PHP_XXX=yes
lines. If I comment them all out and run it again, it works and the whole module builds successfully. WUTtianon commentedon May 29, 2015
Not sure why the
sed
is necessary here, but I got this working. @yosifkit tested compiling it directly into PHP, and it doesn't have any of these issues, so this is extra bizarre.AustinMaddox commentedon Nov 30, 2015
Thank you. Although not very elegant, this does seem to work...
I am able to make odbc connections now. 👍
I'm not sure if I should be concerned, but if I produce a

phpinfo()
in the aforementionedphp:5.6-fpm
container theODBC library
,ODBC_INCLUDE
,ODBC_LFLAGS
,ODBC_LIBS
all have no value.Whereas in another

php:5.6-apache
container I have running, those values are defined...tianon commentedon Nov 30, 2015
tylkomat commentedon Oct 5, 2016
It was not working for me. I made a symlink to
/usr/include
where the file is located.It then continues, but fails a little later while looking for
WINDOWS.H
which should not be possible, since the docker image is based on debian.Can it be because I run it on ubuntu in VMware on Windows?
tianon commentedon Oct 5, 2016
@tylkomat I don't think that's very likely to have any bearing inside the container 😕
Can you share a bit more of your
Dockerfile
? Which image variant are you buildingFROM
?15 remaining items
tianon commentedon Jan 13, 2017
#363
tianon commentedon Jan 14, 2017
#363 (comment) 😢
white-gecko commentedon Apr 26, 2017
For me the
sed
workaround works great: https://github.com/Dockerizing/php-5.6-fpm-odbc-virtuoso/blob/master/Dockerfilemunir3011 commentedon Jun 4, 2017
hi plz help me sir problem i have using sentos 6.7 freepbx problem is in dashboard monthly and daily CALLS INFO TODAY not showing monthly call report not showing today recent call report no showing
tianon commentedon Dec 22, 2017
@munir3011 sounds like you aren't using this Docker image (we have no CentOS-based variants, and this repo doesn't have anything specific to do with FreePBX) 😉
Regarding the original issue described here, I think the workaround we discovered (#103 (comment)) is probably the best we're going to find (given how this particular extension functions), so I'm going to close, but I think this discussion should serve as a good reference point for future users who need ODBC in their
php
-based images. 👍 ❤️For the sake of future travelers, the workaround in question (#103 (comment)) referenced again:
Install odbc php extention https://github.com/docker-library/php/issu…
Testing workaround https://github.com/docker-library/php/issues/103\#…
Testing https://github.com/docker-library/php/issues/103\#issuecommen…
Testing https://github.com/docker-library/php/issues/103\#issuecommen…