Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to docker-php-ext-install odbc #103

Closed
AustinMaddox opened this issue May 28, 2015 · 31 comments
Closed

Unable to docker-php-ext-install odbc #103

AustinMaddox opened this issue May 28, 2015 · 31 comments

Comments

@AustinMaddox
Copy link

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.

@md5
Copy link
Contributor

md5 commented 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.php

I'm not sure what =DIR should be set to, but you can probably figure out out with dpkg or find.

@AustinMaddox
Copy link
Author

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 use dpkg or find to figure that out?

@tianon
Copy link
Member

tianon commented 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??? WAT

@md5
Copy link
Contributor

md5 commented May 28, 2015

I think =DIR should just be /usr. I used dpkg -L unixodbc-dev to see where the files were installed. I'm not sure about the Adabas failure, though.

@tianon
Copy link
Member

tianon commented 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
Copy link
Contributor

md5 commented May 28, 2015

@tianon
Copy link
Member

tianon commented May 28, 2015 via email

@tianon
Copy link
Member

tianon commented May 28, 2015

So, the generated ./configure script has a number of those test "$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. WUT

@tianon
Copy link
Member

tianon commented 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.

FROM php
RUN apt-get update && apt-get install -y unixODBC-dev && rm -rf /var/lib/apt/lists/*
RUN set -x \
    && cd /usr/src/php/ext/odbc \
    && phpize \
    && sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure \
    && ./configure --with-unixODBC=shared,/usr \
    && docker-php-ext-install odbc
$ cat Dockerfile | docker build -
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM php
 ---> 7d0bb448e7ef
Step 1 : RUN apt-get update && apt-get install -y unixODBC-dev && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> bd2adf94f6d0
Step 2 : RUN set -x     && cd /usr/src/php/ext/odbc     && phpize   && sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure   && ./configure --with-unixODBC=shared,/usr  && docker-php-ext-install odbc
 ---> Running in a37c822d6797
+ cd /usr/src/php/ext/odbc
+ phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
+ sed -ri s@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g configure
+ ./configure --with-unixODBC=shared,/usr
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... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for unixODBC support... yes, shared
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
+ docker-php-ext-install odbc
/bin/bash /usr/src/php/ext/odbc/libtool --mode=compile cc -I/usr/include -I. -I/usr/src/php/ext/odbc -DPHP_ATOM_INC -I/usr/src/php/ext/odbc/include -I/usr/src/php/ext/odbc/main -I/usr/src/php/ext/odbc -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  -DHAVE_CONFIG_H  -g -O2   -c /usr/src/php/ext/odbc/php_odbc.c -o php_odbc.lo 
mkdir .libs
 cc -I/usr/include -I. -I/usr/src/php/ext/odbc -DPHP_ATOM_INC -I/usr/src/php/ext/odbc/include -I/usr/src/php/ext/odbc/main -I/usr/src/php/ext/odbc -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 -DHAVE_CONFIG_H -g -O2 -c /usr/src/php/ext/odbc/php_odbc.c  -fPIC -DPIC -o .libs/php_odbc.o
/usr/src/php/ext/odbc/php_odbc.c: In function 'zif_odbc_execute':
/usr/src/php/ext/odbc/php_odbc.c:1382:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
            (void *)params[i-1].fp, 0,
            ^
/usr/src/php/ext/odbc/php_odbc.c: In function 'zif_odbc_cursor':
/usr/src/php/ext/odbc/php_odbc.c:1510:52: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     snprintf(cursorname, max_len+1, "php_curs_%d", (int)result->stmt);
                                                    ^
/usr/src/php/ext/odbc/php_odbc.c: In function 'odbc_do_connect':
/usr/src/php/ext/odbc/php_odbc.c:2646:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    conn_id = (int)index_ptr->ptr;
              ^
/bin/bash /usr/src/php/ext/odbc/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/src/php/ext/odbc/include -I/usr/src/php/ext/odbc/main -I/usr/src/php/ext/odbc -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  -DHAVE_CONFIG_H  -g -O2   -o odbc.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/src/php/ext/odbc/modules  php_odbc.lo -lodbc
cc -shared  .libs/php_odbc.o  -lodbc  -Wl,-soname -Wl,odbc.so -o .libs/odbc.so
creating odbc.la
(cd .libs && rm -f odbc.la && ln -s ../odbc.la odbc.la)
/bin/bash /usr/src/php/ext/odbc/libtool --mode=install cp ./odbc.la /usr/src/php/ext/odbc/modules
cp ./.libs/odbc.so /usr/src/php/ext/odbc/modules/odbc.so
cp ./.libs/odbc.lai /usr/src/php/ext/odbc/modules/odbc.la
PATH="$PATH:/sbin" ldconfig -n /usr/src/php/ext/odbc/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/src/php/ext/odbc/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
grep: /usr/local/etc/php/conf.d/docker-php-ext-odbc.ini: No such file or directory
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f 
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la       modules/* libs/*
 ---> c4abb1f2f24b
Removing intermediate container a37c822d6797
Successfully built c4abb1f2f24b
$ docker run --rm c4abb1f2f24b php -i | grep odbc
Additional .ini files parsed => /usr/local/etc/php/conf.d/ext-odbc.ini
odbc
odbc.allow_persistent => On => On
odbc.check_persistent => On => On
odbc.default_cursortype => Static cursor => Static cursor
odbc.default_db => no value => no value
odbc.default_pw => no value => no value
odbc.default_user => no value => no value
odbc.defaultbinmode => return as is => return as is
odbc.defaultlrl => return up to 4096 bytes => return up to 4096 bytes
odbc.max_links => Unlimited => Unlimited
odbc.max_persistent => Unlimited => Unlimited

@AustinMaddox
Copy link
Author

Thank you. Although not very elegant, this does seem to work...

FROM php
RUN apt-get update && apt-get install -y unixODBC-dev && rm -rf /var/lib/apt/lists/*
RUN set -x \
    && cd /usr/src/php/ext/odbc \
    && phpize \
    && sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure \
    && ./configure --with-unixODBC=shared,/usr \
    && docker-php-ext-install odbc

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 aforementioned php:5.6-fpm container the ODBC library, ODBC_INCLUDE, ODBC_LFLAGS, ODBC_LIBS all have no value.
image

Whereas in another php:5.6-apache container I have running, those values are defined...
image

@tianon
Copy link
Member

tianon commented Nov 30, 2015 via email

@tylkomat
Copy link

tylkomat commented Oct 5, 2016

It was not working for me. I made a symlink to /usr/include where the file is located.

RUN ln -s /usr/include /usr/local/incl \
&& docker-php-ext-configure odbc --with-unixODBC=shared,/usr \
&& docker-php-ext-install odbc

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.

In file included from /usr/src/php/ext/odbc/php_odbc.c:37:0:
/usr/src/php/ext/odbc/php_odbc_includes.h:68:21: fatal error: WINDOWS.H: No such file or directory
 #include <WINDOWS.H>
                     ^
compilation terminated.
Makefile:200: recipe for target 'php_odbc.lo' failed
make: *** [php_odbc.lo] Error 1

Can it be because I run it on ubuntu in VMware on Windows?

@tianon
Copy link
Member

tianon commented 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 building FROM?

@tylkomat
Copy link

tylkomat commented Oct 6, 2016

I was thinking the same. Here is the dockerfile:

FROM php:7.0-fpm

#basics
RUN apt-get update && apt-get install -y imagemagick zip unzip wget nano curl git mysql-client libtidy-dev libpng12-dev libjpeg-dev libicu52 libicu-dev g++ libmagickwand-6.q16-dev && rm -rf /var/lib/apt/lists/* \

# create symlink to support standard /usr/bin/php
&& ln -s /usr/local/bin/php /usr/bin/php \

#composer (global)
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \

# gd
&& docker-php-ext-configure gd --with-jpeg-dir=/usr/lib && docker-php-ext-install gd \

#mysql
&& docker-php-ext-install mysqli \

#mbstring
&& docker-php-ext-install mbstring \

#html tidy
&& docker-php-ext-install tidy \

# Install opcache
&& docker-php-ext-install opcache \

#APCU
&& pecl install apcu \
&& echo "extension=apcu.so" > /usr/local/etc/php/conf.d/apcu.ini \

#intl
&& docker-php-ext-install intl \

#imagick
&& ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/MagickWand-config /usr/bin/ && pecl install imagick && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \

#socket extension
&& docker-php-ext-install sockets \

#db2
&& rm -Rf /opt/ibm
WORKDIR /opt/ibm
ADD v10.5fp8_linuxx64_dsdriver.tar.gz .
RUN apt-get update && apt-get install -y ksh unixodbc-dev && cd dsdriver && ksh installDSDriver && export IBM_DB_HOME="/opt/ibm/dsdriver" && pecl install ibm_db2 && echo "extension=ibm_db2.so\nibm_db2.instance_name=db2inst1" > /usr/local/etc/php/conf.d/ext-ibm_db2.ini \
&& rm -Rf /tmp/pear

# odbc
RUN ln -s /usr/include /usr/local/incl \
&& docker-php-ext-configure odbc --with-unixODBC=shared,/usr \
&& docker-php-ext-install odbc

Is mostly basic stuff, only the db2 setup at the end is a little special.

@tylkomat
Copy link

tylkomat commented Oct 10, 2016

Even this minimal Dockerfile has the same result:

FROM php:7.0-fpm

#basics
RUN apt-get update && apt-get install -y unixodbc-dev && rm -rf /var/lib/apt/lists/* \

# odbc
&& ln -s /usr/include /usr/local/incl \
&& docker-php-ext-configure odbc --with-unixODBC=shared,/usr \
&& docker-php-ext-install odbc
In file included from /usr/src/php/ext/odbc/php_odbc.c:37:0:
/usr/src/php/ext/odbc/php_odbc_includes.h:68:21: fatal error: WINDOWS.H: No such file or directory
 #include <WINDOWS.H>
                     ^
compilation terminated.
Makefile:200: recipe for target 'php_odbc.lo' failed
make: *** [php_odbc.lo] Error 1

@AustinMaddox
Copy link
Author

@tylkomat perhaps you need pdo_odbc?

RUN apt-get install -y \
    unixODBC-dev \
    && docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \
    && docker-php-ext-install pdo_odbc

I also connect to DB2 from one of my applications (see full Dockerfile), but with IBM i Access for Linux rather than the ibm_db2 extension. Just sharing in case other people using ODBC connections to DB2 find it useful.

@Halama
Copy link

Halama commented Oct 11, 2016

I had the same issue for php 7.
This version works for me:

FROM php:7
RUN apt-get update \
  && apt-get install unzip git unixODBC-dev libpq-dev -y

RUN set -x \
    && docker-php-source extract \
    && cd /usr/src/php/ext/odbc \
    && phpize \
    && sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure \
    && ./configure --with-unixODBC=shared,/usr \
    && docker-php-ext-install odbc \
    && docker-php-source delete

@tylkomat
Copy link

Thanks you both, @AustinMaddox and @Halama, for the hints. Both your examples compile fine.

@tianon
Copy link
Member

tianon commented Jan 9, 2017

This is definitely not a Debian-related issue -- I tested in php:7.1-alpine and got the same funky broken lines in configure. 😞

@tianon
Copy link
Member

tianon commented Jan 9, 2017

This is the only thing I can find that might be generating these bits (in phpize.m4):

AC_DEFUN([PHP_ALWAYS_SHARED],[
  ext_output="yes, shared"
  ext_shared=yes
  test "[$]$1" = "no" && $1=yes
])dnl

@tianon
Copy link
Member

tianon commented Jan 9, 2017

If I manually edit that file to comment out the offending line, the generated configure script doesn't include it either -- not sure what the unintended side-effects of making that change globally are, though. 😰

@tianon
Copy link
Member

tianon commented Jan 9, 2017

Oh! This function is implemented differently in /usr/src/php/configure.in (ie, during the normal PHP build process)!

/usr/src/php/configure.in:137:AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl

(ie, empty)

So, this is a quirk of phpize specifically, and we probably need to maintain it for phpize on non-stdlib extensions somehow, but patch it out for stdlib builds.

@tianon
Copy link
Member

tianon commented Jan 9, 2017

I guess we could just prepend AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl into the top of every /usr/src/php/ext/*/config.m4 file -- that should do the trick, I think, but I haven't tested.

@tianon
Copy link
Member

tianon commented Jan 9, 2017

The following builds successfully:

FROM php:7.1-alpine

RUN set -ex; \
	docker-php-source extract; \
	{ \
		echo '# https://github.com/docker-library/php/issues/103#issuecomment-271413933'; \
		echo 'AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl'; \
		echo; \
		cat /usr/src/php/ext/odbc/config.m4; \
	} > temp.m4; \
	mv temp.m4 /usr/src/php/ext/odbc/config.m4; \
	apk add --no-cache unixodbc-dev; \
	docker-php-ext-configure odbc --with-unixODBC=shared,/usr; \
	docker-php-ext-install odbc; \
	docker-php-source delete

@AnatolyRugalev
Copy link

AnatolyRugalev commented Jan 10, 2017

@tianon Thank you for investigation! This worked for me like a charm

@tianon
Copy link
Member

tianon commented Jan 11, 2017

@AnatolyRugalev my plan is to add this to all the config.m4 files shipped in the image directly so that they "just work" out of the box properly 👍

@tianon
Copy link
Member

tianon commented Jan 13, 2017

#363

@tianon
Copy link
Member

tianon commented Jan 14, 2017

#363 (comment) 😢

So, this is actually a lot more complex than I thought, and this solution can't actually work as a 100% general solution to the problem. The reason phpize has these lines is so that when we build extensions, it creates shared modules, which is actually the only reason any of our docker-php-ext-* hacks work.

For example, if we wanted to build pdo_mysql with this, we'd have to use ./configure --with-pdo-mysql=shared, where this PHP_ALWAYS_SHARED macro would instead just swap the default "no" over to a "yes" so we get a shared library.

The problem comes with extensions like odbc, where there isn't a single implementation that's "the" canonical implementation -- there are several that can provide the functionality, and the way phpize expands them ends up force-enabling all of them. It's honestly a little unfortunate that these config.m4 files are designed such that "no" gets converted to "yes" rather than something like "default" getting converted to either "yes" or "no" depending on the context of the build (because then at least we could do ./configure --with-adabas=no --with-sapdb=no ... as a workaround).

We might just have to live with the workaround I pointed out in #103 (comment). 😢

@white-gecko
Copy link

white-gecko commented Apr 26, 2017

For me the sed workaround works great: https://github.com/Dockerizing/php-5.6-fpm-odbc-virtuoso/blob/master/Dockerfile

@munir3011
Copy link

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
Copy link
Member

tianon commented 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:

FROM php:7.1-alpine

RUN set -ex; \
	docker-php-source extract; \
	{ \
		echo '# https://github.com/docker-library/php/issues/103#issuecomment-271413933'; \
		echo 'AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl'; \
		echo; \
		cat /usr/src/php/ext/odbc/config.m4; \
	} > temp.m4; \
	mv temp.m4 /usr/src/php/ext/odbc/config.m4; \
	apk add --no-cache unixodbc-dev; \
	docker-php-ext-configure odbc --with-unixODBC=shared,/usr; \
	docker-php-ext-install odbc; \
	docker-php-source delete

@tianon tianon closed this as completed Dec 22, 2017
robertoperuzzo pushed a commit to robertoperuzzo/php-as400 that referenced this issue May 7, 2021
robertoperuzzo pushed a commit to robertoperuzzo/php-as400 that referenced this issue Jul 30, 2021
robertoperuzzo pushed a commit to robertoperuzzo/php-as400 that referenced this issue Jul 30, 2021
robertoperuzzo pushed a commit to robertoperuzzo/php-as400 that referenced this issue Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants