[freetds] how can i use freetds.conf with PHP?

Spyros Ioakim sioakim at atlas.ace-hellas.gr
Tue May 6 03:15:22 EDT 2003


I just upgraded to the nightly build and solved my problems with long
queries that I had.
The problem now is that I can't insert or update a field with Greek
characters (I get english characters with ? like mentioned in the faq)
I read in the manual that you need something like the following:
 
[mssql]
        host = 192.168.2.221
        port = 1433
        tds version = 7.0
        client charset = GREEK

so my PHP code is as simple as that:
 
putenv('TDSVER=7.0');
putenv('FREETDSCONF=/usr/local/freetds/etc/freetds.conf');
$connectid = mssql_connect("mssql" , "sa" ,"sa" );
$r = mssql_select_db ("icad");
$query="update icad_weather_sun set hmeromhnia='$hmnia',
giortazoyn='$output', eorth='$eorth' where date_entered='2'";
$result = mssql_query ($query);

the values of $output and $eorth are in Greek.
 
Problem is that php can't locate the server.
I'm using as I said freetds without any problems to connect to databases
and execute queries but not inserting greek characters except on the
script above.
I had solved the problem with an older version of freetds by setting
TDSVER=4.0.
 
My questions:
Do I need to recompile PHP with a new freetds.conf?
Does PHP even check for freetds.conf?
How can I put in a PHP script that I want client charset Greek?
 
I have compiled freetds with:
./configure --with-tdsver=7.0 --enable-msdblib --with-unixodbc
--prefix=/usr/local/freetds/
 
and php (4.3.1) with:
./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs
--with-sybase-ct=/usr/local/freetds/ --with-gd
--with-zlib-dir=/usr/include/ --disable-cli --with-imap --with-kerberos
--with-imap-ssl --with-unixODBC
 
I'm running apache 1.3.27. System is RH 9.
 
Any help would be greatly appreciated.
 
Thanks in advance,
Spyros
 



More information about the FreeTDS mailing list