Saru'mana! :)
  Configs-urile luau kix :)


========================8======================
Tuesday, March 02, 2004, 1:56:39 PM, Ground wrote:

GZ> Quoting Ovidiu Gabor <[EMAIL PROTECTED]>:
>> 
>> FS> Din cate vad din intrebare vrei o conexiune la mssql ( microsoft) ?
>> FS> daca este asa , atunci tre sa pui ODBC pe statia Windows, si dupa
>> FS> aceea totul este ok.
>>
>>   Cu freetds inca imi mai bat capul acum.
>>   Daca nu cer prea multe... ODBC drivers pt. Win de pe unde se poate
>>   aduna? :) Nu vin implicit cu MS-SQL Server? (e un sqlserver2000 ).
>>   Ar fi mai practica varianta cu ODBC ce e drept.

GZ> Am vazut ca au trecut citeva zile si tot nu s-a rezolvat discutia asta,
GZ> asa ca am cautat niste instructiuni pe care le aveam din vremuri
GZ> imemoriale pentru PHP+MSSQL pe Linux, folosind freetds+unixodbc. Nu
GZ> mai stiu unde le-am gasit (parca in niste comentarii pe phpbuilder) dar
GZ> ideea e ca functioneaza fara probleme (testat personal).

GZ> ----------------------------------------------------------------------
GZ> How to make php capable of connecting to SQL Server 2000:

GZ> 1. UNIXODBC

GZ> Get unixodbc. Compile with:
GZ> # ./configure --prefix=/opt/unixodbc --sysconfdir=/etc \
GZ> --localstatedir=/var

GZ> Install.

GZ> 2. FreeTDS

GZ> Get FreeTDS. Compile with:
GZ> # ./configure --prefix=/opt/freetds --sysconfdir=/etc \
GZ> --localstatedir=/var --with-unixodbc=/opt/unixodbc \
GZ> --enable-msdblib --with-tdsver=8.0

GZ> Install.

GZ> 3. PHP

GZ> Install PHP with these options:
GZ> --with-mssql=/opt/freetds

GZ> 4. Set environment vars:

GZ> export SYBASE=/opt/freetds
GZ> export TDSVER=8.0
GZ> export FREETDSCONF=/etc/freetds.conf

GZ> 5. Configure FreeTDS:

GZ> Edit /etc/freetds.conf, add this:

GZ> [MsSqlServer]
GZ> host = MS.SQL.SERVER.IP
GZ> tds version = 8.0
GZ> port = 1433
GZ> try server login = yes

GZ> 6. Configure unixODBC driver:

GZ> Edit /etc/tds/tds.driver.template, add this:

GZ> [TDS]
GZ> Description     = Free TDS
GZ> Driver          = /opt/freetds/lib/libtdsodbc.so
GZ> FileUsage       = 2

GZ> Then execute this command to activate the configuration:
GZ> # odbcinst -i -d -f /etc/tds/tds.driver.template

GZ> 7. Configure unixODBC data source:

GZ> Edit /etc/tds/tds.datasource.template, add this:

GZ> [Fast]
GZ> Driver        = TDS
GZ> Description   = Some MSSQL database
GZ> Trace         = No
GZ> Servername    = MsSqlServer
GZ> Database      = DBNAME
GZ> UID           = USERNAME

GZ> Execute this command to activate the configuration:
GZ> # odbcinst -i -s -f /etc/tds/tds.datasource.template

GZ> 8. Test FreeTDS

GZ> Try to connect using this command (you will be prompted for password):
GZ> # tsql -S MS.SQL.SERVER.IP -U USERNAME

GZ> 9. Test PHP

GZ> Check phpinfo(), it should have the "mssql" entry.

GZ> This code should work:

GZ> $ident=mssql_connect('MsSqlServer','USERNAME');
GZ> mssql_select_db('DBNAME');
GZ> $result=mssql_query('select top 20 * from TableNameHere');
GZ> echo '<TABLE border=1>';
GZ> while ($row=mssql_fetch_row($result)) {  
GZ>   echo '<tr>';
GZ>   for ($i=0;$i<count($row);$i++) echo '<td>'.$row[$i];
GZ> }
GZ> echo '</TABLE>';
GZ> ----------------------------------------------------------------------




--- 
Detalii despre listele noastre de mail: http://www.lug.ro/


Raspunde prin e-mail lui