2011-01-27 2 views
1

내 freetds.conf FreeTDS를 사용하여 Sybase에 어떻게 연결할 수 있습니까?

# /usr/local/etc/freetds.conf 
# $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $ 
# 
# This file is installed by FreeTDS if no file by the same 
# name is found in the installation directory. 
# 
# For information about the layout of this file and its settings, 
# see the freetds.conf manpage "man freetds.conf". 

# Global settings are overridden by those in a database 
# server specific section 
[global] 
     # TDS protocol version 
; tds version = 4.2 

    # Whether to write a TDSDUMP file for diagnostic purposes 
    # (setting this to /tmp is insecure on a multi-user system) 
    dump file = /tmp/freetds.log 
; debug flags = 0xffff 

    # Command and connection timeouts 
; timeout = 10 
; connect timeout = 10 

    # If you get out-of-memory errors, it may mean that your client 
    # is trying to allocate a huge buffer for a TEXT field. 
    # Try setting 'text size' to a more reasonable limit 
    text size = 64512 

# A typical Sybase server 
[egServer50] 
    host = symachine.domain.com 
    port = 5000 
    tds version = 5.0 

# A typical Microsoft server 
[egServer70] 
    host = ntmachine.domain.com 
    port = 1433 
    tds version = 7.0 

[myserver] 
    host = myserver.com 
    port = 5000 
    tds version = 5.0 

sybase.php :

<?php 

$server = 'myserver'; 
$user = 'user'; 
$pwd = 'pwd'; 
$db  = 'db'; 

@sybase_connect($server, $user, $pwd) or die('Cannot connect'); 

echo "OK\n"; 

내가 CLI, php sybase.php를 통해 실행했을 때 그것은 잘 작동합니다. 하지만 웹 서버를 통해 실행하면 연결되지 않습니다. 누군가 내 코드에 어떤 문제가 있는지 알고 있습니까?

I도 (php sybase.php하지만 웹 서버를 통해를 사용하여

putenv("FREETDSCONF=/usr/local/etc/freetds.conf");

하지만 아무것도 심지어 sybase_connect() 전에 freetds.conf에 잘못된 경로를 넣어 시도하고 그래도 코드가 잘 실행됩니다 발생하지 퍼팅 시도했다). 내 php.ini에서 내가 주석 ;extension=php_sybase_ct.dll을하지 않았다

<br /> 
<b>Warning</b>: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/php_sybase_ct.dll' - /usr/lib/php/extensions/php_sybase_ct.dll: cannot open shared object file: No such file or directory in <b>Unknown</b> on line <b>0</b><br /> 
<br /> 
<b>Warning</b>: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/php_sybase_ct.dll' - /usr/lib/php/extensions/php_sybase_ct.dll: cannot open shared object file: No such file or directory in <b>Unknown</b> on line <b>0</b><br /> 
<br /> 
<b>Warning</b>: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/php_sybase_ct.dll' - /usr/lib/php/extensions/php_sybase_ct.dll: invalid ELF header in <b>Unknown</b> on line <b>0</b><br /> 
<br /> 
<b>Warning</b>: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/php_sybase_ct.dll' - /usr/lib/php/extensions/php_sybase_ct.dll: invalid ELF header in <b>Unknown</b> on line <b>0</b><br /> 

내가 리눅스에서 일하고 있기 때문에 :

BTW, 난 내 아파치를 다시 시작 때마다 이러한 오류를 얻었다. phpinfo()을 확인한 결과 sybase_ct 섹션이 표시됩니다. 다음 인수를 사용하여 PHP를 만들었습니다.

'./configure' '--with-apxs2=/usr/sbin/apxs' '--prefix=/usr' '--libdir=/usr/lib' '--with-libdir=lib' '--sysconfdir=/etc' '--disable-safe-mode' '--disable-magic-quotes' '--enable-zend-multibyte' '--enable-mbregex' '--enable-tokenizer=shared' '--with-config-file-scan-dir=/etc/php' '--with-config-file-path=/etc/httpd' '--enable-mod_charset' '--with-layout=PHP' '--enable-sigchild' '--enable-xml' '--with-libxml-dir=/usr' '--enable-simplexml' '--enable-spl' '--enable-filter' '--disable-debug' '--with-openssl=shared' '--with-pcre-regex=/usr' '--with-zlib=shared,/usr' '--enable-bcmath=shared' '--with-bz2=shared,/usr' '--enable-calendar=shared' '--enable-ctype=shared' '--with-curl=shared' '--with-curlwrappers' '--with-mcrypt=/usr' '--enable-dba=shared' '--with-gdbm=/usr' '--with-db4=/usr' '--enable-exif=shared' '--enable-ftp=shared' '--with-gd=shared' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-xpm-dir=/usr' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-gettext=shared,/usr' '--with-gmp=shared,/usr' '--with-iconv=shared' '--with-imap-ssl=/usr' '--with-imap=/usr/local/lib/c-client' '--with-ldap=shared' '--enable-mbstring=shared' '--enable-hash' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' '--enable-pdo=shared' '--with-pdo-mysql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pspell=shared,/usr' '--with-enchant=shared,/usr' '--with-mm=/usr' '--enable-shmop=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--enable-sockets' '--with-sqlite=shared' '--enable-sqlite-utf8' '--with-regex=php' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx=shared' '--with-xsl=shared,/usr' '--enable-zip=shared' '--with-tsrm-pthreads' '--enable-shared=yes' '--enable-static=no' '--with-gnu-ld' '--with-pic' '--with-sybase-ct=/usr/local/' '--build=i486-slackware-linux' 

답변

1

방금 ​​문제가 해결되었습니다. 분명히, 나는이 작업을 수행해야합니다

  1. 이 있는지 확인 로그 파일은 다른 사람 쓰기입니다 : chmod o+w /tmp/freetds.log
  2. I 설정 파일에 도메인 이름을 사용할 수 없습니다, 내가 가진 것 사용 에 IP 주소는 서버의입니다.

나의 새로운 /usr/local/etc/freetds.conf : /tmp/freetds.log에서

[myserver] 
    host = 10.10.10.10 
    port = 5000 
    tds version = 5.0 

내 오류가 나는 도메인 이름을 사용하는 경우 :

config.c:257:Success: [myserver] defined in /usr/local/etc/freetds.conf. 
iconv.c:363:iconv to convert client-side data to the "ISO-8859-1" character set 
iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE" 
login.c:405:IP address pointer is empty 
login.c:407:Server myserver not found! 

P/S : 내가 무슨 짓을했는지 모르겠지만, ' 오류가 발생하지 않아 PHP가 더 이상 php_sybase_ct.dll을로드하려고합니다.