[unixODBC-support] Problem between unixodbc and PHP5 (Nick Gorham)

Jean-Joseph YVON jj.yvon at dis-info.com
Wed Mar 28 08:21:30 BST 2012


Hello,

Thanks for your help Nick

My log works well when i use isql, i have the log of connection from isql.
I have test conection with isql with all my user and its work well too

The PHP script give me nothing  he print the echo statement but nothing more (i am not very good in PHP) and i haven't the connection in the log.

JJY

On 27/03/2012 17:07, Jean-Joseph YVON wrote:
>
> Hi,
>
> First, sorry for my english.
>
> I need to creat an ODBC connection to a SQL Server for a web service
> in WINDEV
>
> I am running unixODBC on an ubuntu server 11.10 X64, i have installed
> unixODBC and freeTDS with apt-get.
>
> I have edited  odbcinst.ini like this :
>
> [ODBC]
>
> Trace           = Yes
>
> TraceFile       = /var/log/odbc.log
>
> ForceTrace      = Yes
>
> Debug           = Yes
>
> DebugFile       = /var/log/odbc.bug
>
> [FreeTDS]
>
> Description     = TDS driver
>
> Driver          = /usr/lib/odbc/libtdsodbc.so
>
> Setup          = /usr/lib/odbc/libtdsS.so
>
> CPTimeout      =
>
> CPReuse        =
>
> FileUsage       = 1
>
> I have edited  odbc.ini like this :
>
> [ODBC Data Sources]
>
> MSZIMO          = mssql server
>
> [MSZIMO]
>
> Driver          = /usr/lib/odbc/libtdsodbc.so
>
> Description     = ODBC connection via FreeTDS
>
> Trace           = No
>
> #Servername     = MSSQL
>
> Server          = 192.168.10.201
>
> Port            = 1433
>
> TDS_Version     = 7.0
>
> Database        = NEWZIMMO
>
> I have used this command for a test :
>
> isql -v MSZIMO login password
>
> and  i can connect to my database
>
> When i test from My web service or a php script i see no connection in
> log.
>
> The php scrip i use for testing :
>
> <?php
>
> putenv("ODBCSYSINI=/etc/odbcinst.ini");
>
> putenv("ODBCINI=/etc/odbc.ini");
>
> echo "Connexion...<br>";
>
> # connect to a DSN "MSZIMO"
>
> $connect = odbc_connect("MSZIMO", "login", "password");
>
> #result ID
>
> echo $connect;
>
> # query the agence table for all fields
>
> $query = "SELECT * FROM agence";
>
> echo $query;
>
> # perform the query
>
> $result = odbc_exec($connect, $query);
>
> echo $result;
>
> # close the connection
>
> odbc_close($connect);
>
> ?>
>
> Someone could help me ?
>
> I don't see what i am doing wrong.
>
> Jean-Joseph
>

You don't say what error you get from running the PHP script? The lack of logs may be a permission problem, the web server may not have permission to write to the log file.

--
Nick


More information about the unixODBC-support mailing list