[unixODBC-support] Problem between unixodbc and PHP5

Nick Gorham nick at lurcher.org
Tue Mar 27 17:22:30 BST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20120327/0d081c6d/attachment-0001.html>


More information about the unixODBC-support mailing list