PHP + Apache + ODBC on linux
| From: | Jose Morales | Date: | Wed, 31 Jul 2002 08:15:12 +0000 |
| Subject: | PHP + Apache + ODBC on linux | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-110477@lists.php.net to get a copy of this message | ||
Hi to all!!
I have a problem and i think maby somebody can help me.
I have an MS Sql server on a Windows 2000.
I have a PHP web in a linux debian. Im trying to access to the MS SQL server through unixodbc.
Unixodbc works well becouse y test it under linux , with isql and sqsh, and i know that it works.
in my PHP code I load the odbc module with dl('odbc'), and it works, but
the problem is that when i do
odbc_pconnect("mydsn","myuser","mypasswd"); y have an error like this:
Warning: SQL error: [unixODBC] Could not find DSN in odbc.ini, SQL state 08001 in SQLConnect in
/path/to/my/page.php on line XX
Warning: Supplied argument is not a valid ODBC-Link resource in /path/to/my/page.php on line XX
When i test the odbc with isql under linux, i think that isql find an ..odbc.ini under $HOME
the file is like this:
[ODBC Data Sources]
cdr2 = FreeTDS
[cdr2]
Servername = 192.168.129.6
TraceFile = /tmp/odbc.log
Driver = /usr/lib/odbc/libtdsodbc.so
Description = logs del call manager.
DSN = cdr2
DB = CDR
User = myuser
Password = mypasswd
Port = 1433
[Default]
Driver = /usr/lib/odbc/libtdsodbc.so
and i think that the problem is that apache user dont find this file. My apache user is www-data,
and i try to copy an .odbc.ini file to this user $HOME, but dont works...
the conclusions are:
1º ODBC works
2º I have PHP compiled with ODBC support.
3º other users with an .odbc.ini file under $HOME can access to ODBC.
but the problem is still there :(
so my question is: how can i access from PHP on debian to a well configured ODBC ?
thanks in advance!!