osx为php配置pdo-odbc
来源:互联网 发布:it occured that 编辑:程序博客网 时间:2024/06/05 09:45
参考:http://stackoverflow.com/questions/9958920/enabling-php-pdo-odbc-extension-on-a-mac-osx
AndyMacBookPro:pdo_odbc andy$ ./configure --with-pdo-odbc=/usr/local/unixODBC
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/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... i386-apple-darwin13.3.0
checking host system type... i386-apple-darwin13.3.0
checking target system type... i386-apple-darwin13.3.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/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... no
checking for awk... awk
checking if awk is broken... no
checking for ODBC v3 support for PDO... yes, shared
checking for PDO includes... checking for PDO includes... /usr/include/php/ext
checking for selected PDO ODBC flavour... configure: error: Unknown ODBC flavour /usr/local/unixODBC
include and lib dirs are looked for under 'dir'.
'flavour' can be one of: ibm-db2, iODBC, unixODBC, generic
If ',dir' part is omitted, default for the flavour
you have selected will used. e.g.:
--with-pdo-odbc=unixODBC
will check for unixODBC under /usr/local. You may attempt
to use an otherwise unsupported driver using the "generic"
flavour. The syntax for generic ODBC support is:
--with-pdo-odbc=generic,dir,libname,ldflags,cflags
When build as shared the extension filename is always pdo_odbc.so
AndyMacBookPro:pdo_odbc andy$
报错,所以改为:
AndyMacBookPro:pdo_odbc andy$ ./configure --with-pdo-odbc=unixodbc
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/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... i386-apple-darwin13.3.0
checking host system type... i386-apple-darwin13.3.0
checking target system type... i386-apple-darwin13.3.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/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... no
checking for awk... awk
checking if awk is broken... no
checking for ODBC v3 support for PDO... yes, shared
checking for PDO includes... checking for PDO includes... /usr/include/php/ext
checking for selected PDO ODBC flavour... unixodbc
libs /usr/local/lib,
headers /usr/local/include
checking for odbc.h in /usr/local/include... no
checking for odbcsdk.h in /usr/local/include... no
checking for iodbc.h in /usr/local/include... no
checking for sqlunix.h in /usr/local/include... no
checking for sqltypes.h in /usr/local/include... yes
checking for sqlucode.h in /usr/local/include... yes
checking for sql.h in /usr/local/include... yes
checking for isql.h in /usr/local/include... no
checking for sqlext.h in /usr/local/include... yes
checking for isqlext.h in /usr/local/include... no
checking for udbcext.h in /usr/local/include... no
checking for sqlcli1.h in /usr/local/include... no
checking for LibraryManager.h in /usr/local/include... no
checking for cli0core.h in /usr/local/include... no
checking for cli0ext.h in /usr/local/include... no
checking for cli0cli.h in /usr/local/include... no
checking for cli0defs.h in /usr/local/include... no
checking for cli0env.h in /usr/local/include... no
checking for SQLBindCol in -lodbc... yes
checking for SQLAllocHandle in -lodbc... yes
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
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... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.3.0 dyld
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
AndyMacBookPro:pdo_odbc andy$
之后make就可以了~~~
Yes!!!
然后再将pdo_odbc.so拷贝到php保存扩展的目录:/usr/lib/php/extensions/no-debug-non-zts-20100525/ 就可以了~~~
AndyMacBookPro:pdo_odbc andy$ sudo find / -name redis.so
Password:
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/Users/andy/Documents/phpredis/.libs/redis.so
/Users/andy/Documents/phpredis/.libs/redis.so.dSYM/Contents/Resources/DWARF/redis.so
/Users/andy/Documents/phpredis/modules/redis.so
/usr/lib/php/extensions/no-debug-non-zts-20100525/redis.so
AndyMacBookPro:pdo_odbc andy$
然后就cp:
AndyMacBookPro:pdo_odbc andy$ sudo cp /Users/andy/Downloads/php-5.4.30/ext/pdo_odbc/modules/pdo_odbc.so /usr/lib/php/extensions/no-debug-non-zts-20100525/
AndyMacBookPro:pdo_odbc andy$
之后去php.ini中配置开启pdo_odbc.so扩展,我的位于:/private/etc/php.ini
AndyMacBookPro:modules andy$ sudo find / -name php.ini
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/private/etc/php.ini
/usr/local/etc/php/5.4/php.ini
AndyMacBookPro:modules andy$
添加extension=pdo_odbc.so 就可以了~~
然后保存重启apache服务器~~~
sudo apachectl restart
PDO_ODBC
pdopdoDO_ODBCpdo
之后我们再访问sql server数据库,提示错误终于从:
系统发生错误
[ 错误信息 ]
变为:
系统发生错误
[ 错误信息 ]
php通过pdo连接sqlserver有希望啦~~~~
如果有心的同学能发现这也是isql 连接时的报错,说明终于使用unixodbc来建立连接了~~~,后面我们要解决的就是上面提示的这个问题了~~~
- osx为php配置pdo-odbc
- php osx php pdo连接mssql方法
- CentOS PHP - PDO 支持 MYSQL 和 ODBC
- PHP 配置PDO
- PHP PDO配置和使用
- osx 配置 Apache+Mysql+Php
- 64为WIN7 odbc配置
- OSX 中使用odbc
- OSX下为php安装redis扩展~~~
- OSX 中为php安装 apc 扩展
- OSX为PHP添加mysql扩展
- 深入分析PHP PDO配置及使用方法
- MAC OSX 下配置Eclipse+PHP+XDEBUG
- OSX中配置php添加mssql扩展
- php学习中---环境配置(OSX)
- mac(osx)配置apache+mysql+php+phpmyadmin
- php,try catch例子与php连mmsql数据库二种方法(pdo与odbc)
- 为使用ODBC连接trafodion软件,安装ODBC和配置
- nodejs+express4.0+mongodb安装方法 for Linux, Mac
- java IO总结之字节流操作文件读写(高效)
- 中断处理的tasklet(小任务)机制和workqueue(工作队列)机制
- 创建jsp自定标签步骤
- repo 中shell 调用 python
- osx为php配置pdo-odbc
- 跨域请求之jQuery的ajax jsonp的使用解惑
- mvc DevExpress 汉化 使用 说明
- lucene3.6.1 经典案例 入门教程
- boost log的前端和后端
- java4android第三十,三十一集_java中的异常
- LINUX,查看各种硬件配置(CPU,硬盘,内存等)
- 蜀门私服
- 【C++ STL】细数C++ STL 的那些事---List(双向链表)