-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Comments
It looks like you'll want to install I'm not sure what |
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 |
I've been hammering my head on this one for at least 30 minutes, and I've found something interesting in the compiled test "$PHP_ADABAS" = "no" && PHP_ADABAS=yes If |
I think |
Yeah, I've been hacking at it for a while (and @yosifkit tried too) and Adabas screws it up every single way we try ( |
That one's failing at build, not at configure. 😕
|
So, the generated |
Not sure why the 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 |
Yeah, I have no idea if that's a problem. 😞 If it's actively
working, I'd wager it probably isn't though. 👍
|
It was not working for me. I made a symlink to 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 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? |
@tylkomat I don't think that's very likely to have any bearing inside the container 😕 Can you share a bit more of your |
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. |
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 |
@tylkomat perhaps you need
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. |
I had the same issue for php 7.
|
Thanks you both, @AustinMaddox and @Halama, for the hints. Both your examples compile fine. |
This is definitely not a Debian-related issue -- I tested in |
This is the only thing I can find that might be generating these bits (in AC_DEFUN([PHP_ALWAYS_SHARED],[
ext_output="yes, shared"
ext_shared=yes
test "[$]$1" = "no" && $1=yes
])dnl |
If I manually edit that file to comment out the offending line, the generated |
Oh! This function is implemented differently in /usr/src/php/configure.in:137:AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl (ie, empty) So, this is a quirk of |
I guess we could just prepend |
The following builds successfully: FROM php:7.1-alpine
RUN set -ex; \
docker-php-source extract; \
{ \
echo '# //www.greatytc.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 Thank you for investigation! This worked for me like a charm |
@AnatolyRugalev my plan is to add this to all the |
|
For me the |
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 |
@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 For the sake of future travelers, the workaround in question (#103 (comment)) referenced again:
|
The installation of the odbc php extension fails.
Results in...
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.
The text was updated successfully, but these errors were encountered: