I have XAMPP 1.7 running, with php 5.2.8. Old yes but almost all of my running projects are
built on top of it. Recently i got a project that requires to use MSSQL-SQLEXPRESS.
I chose to use Codeigniter 2.1.2 as the framework to develop. One of teammate is using
MS-Windows environment and he used sqldrv as the database driver with ease.
While my part using GNU/linux Fedora19 64bit having problem. After while searching how to
connect to SQLExpress than the easy answer itu to use FreeTDS and unixODBC. Modify
php.ini of XAMPP 1.7 with no problem. After restart apache and run one of my test_odbc
file shows an error "undefined reference odbc_connect()"
More googling and ends up that i convincing my-self to compile the odbc library from scratch.
So i yum install unixODBC-devel.i686 and so freetds-devel.i686 then download php 5.2.8
source file from Here. Done the extraction, now to build the extention.
$ pwd
/opt/php5-src/php-5.2.8-src/ext/odbc
$ /opt/lampp/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
configure.in:3: warning: prefer named diversions
configure.in:144: warning: AC_CACHE_VAL(lt_prog_compiler_static_works, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from...
aclocal.m4:3535: AC_LIBTOOL_LINKER_OPTION is expanded from...
aclocal.m4:5473: _LT_AC_LANG_C_CONFIG is expanded from...
At this point if you check the modules/ you will see odbc.so sits there, yeah!
I like the manual-way so i just copy and paste on my XAMPP extention folder.
/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/
Restart the Apache service and run my script yeah! Now it connects like charm :))
built on top of it. Recently i got a project that requires to use MSSQL-SQLEXPRESS.
I chose to use Codeigniter 2.1.2 as the framework to develop. One of teammate is using
MS-Windows environment and he used sqldrv as the database driver with ease.
While my part using GNU/linux Fedora19 64bit having problem. After while searching how to
connect to SQLExpress than the easy answer itu to use FreeTDS and unixODBC. Modify
php.ini of XAMPP 1.7 with no problem. After restart apache and run one of my test_odbc
file shows an error "undefined reference odbc_connect()"
More googling and ends up that i convincing my-self to compile the odbc library from scratch.
So i yum install unixODBC-devel.i686 and so freetds-devel.i686 then download php 5.2.8
source file from Here. Done the extraction, now to build the extention.
$ pwd
/opt/php5-src/php-5.2.8-src/ext/odbc
$ /opt/lampp/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
configure.in:3: warning: prefer named diversions
configure.in:144: warning: AC_CACHE_VAL(lt_prog_compiler_static_works, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from...
aclocal.m4:3535: AC_LIBTOOL_LINKER_OPTION is expanded from...
aclocal.m4:5473: _LT_AC_LANG_C_CONFIG is expanded from...
**(And bunch of messages, truncated for simplicity)**
$ sudo yum install glibc-devel.i686
You need the glibc-devel so you can build 32bit application on 64bit system
$ ./configure --with-php-config=/opt/lampp/bin/php-config --with-unixODBC=shared,/usr CFLAGS='-m32'
Then Error that saying
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!
You could solve this by modifying Makefile that being generated, goto line 4737 and removed
ext_output="yes, shared"
ext_shared=yes
test "$PHP_ADABAS" = "no" && PHP_ADABAS=yes
I don't know what caused the double occurrences that simply override the previous check
and initialization. Re-run the configure
$ make
/bin/sh /opt/php5-src/php-5.2.8-src/ext/odbc/libtool --mode=compile gcc -I. -I/opt/php5-src/php-5.2.8-src/ext/odbc -DPHP_ATOM_INC -I/opt/php5-src/php-5.2.8-src/ext/odbc/include -I/opt/php5-src/php-5.2.8-src/ext/odbc/main -I/opt/php5-src/php-5.2.8-src/ext/odbc -I/opt/php5-src/include/php -I/opt/php5-src/include/php/main -I/opt/php5-src/include/php/TSRM -I/opt/php5-src/include/php/Zend -I/opt/php5-src/include/php/ext -I/opt/php5-src/include/php/ext/date/lib -I/usr/local/incl -I/opt/php5-src/include/php -DHAVE_CONFIG_H -m32 -c /opt/php5-src/php-5.2.8-src/ext/odbc/php_odbc.c -o php_odbc.lo
gcc -I. -I/opt/php5-src/php-5.2.8-src/ext/odbc -DPHP_ATOM_INC -I/opt/php5-src/php-5.2.8-src/ext/odbc/include -I/opt/php5-src/php-5.2.8-src/ext/odbc/main -I/opt/php5-src/php-5.2.8-src/ext/odbc -I/opt/php5-src/include/php -I/opt/php5-src/include/php/main -I/opt/php5-src/include/php/TSRM -I/opt/php5-src/include/php/Zend -I/opt/php5-src/include/php/ext -I/opt/php5-src/include/php/ext/date/lib -I/usr/local/incl -I/opt/php5-src/include/php -DHAVE_CONFIG_H -m32 -c /opt/php5-src/php-5.2.8-src/ext/odbc/php_odbc.c -fPIC -DPIC -o .libs/php_odbc.o
In file included from /opt/php5-src/php-5.2.8-src/ext/odbc/php_odbc.c:37:0:
/opt/php5-src/php-5.2.8-src/ext/odbc/php_odbc_includes.h:74:21: fatal error: WINDOWS.H: No such file or directory
#include
^
compilation terminated.
make: *** [php_odbc.lo] Error 1
Well at this point is strange if you open the php_odbc_includes.h:74 it says HAVE_ADABAS
blabla, i just removed all off them until it reaches the #elif ... HAVE_UNIXODBC
$ make
And success it says
Build complete.
Don't forget to run 'make test'.
I like the manual-way so i just copy and paste on my XAMPP extention folder.
/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/
Restart the Apache service and run my script yeah! Now it connects like charm :))
Comments