All,
I am trying to install and get working the progress ODBC driver for Debian.
I have installed the progress driver no problem, however, when I try to connect in PHP using ODBC_Connect I get an error:
Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/usr/dlc/odbc/lib/pgoe1022.so' : file not found, SQL state 01000 in SQLConnect
Next step was for me to see if the file existed and if that file had all of its dependencies.
So I issued the following command:
ldd /usr/dlc/odbc/lib/pgoe1022.so
And got the following:
linux-gate.so.1 => (0xb773e000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb7505000)
libpgicu22.so => not found
libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb7500000)
libstdc++-libc6.2-2.so.3 => not found
libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xb74da000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb7375000)
/lib/ld-linux.so.2 (0xb773f000)
Now I am stumped! I cannot get hold of the missing files.
Anyone able to assist at all please?
Regards
Col
It is always helpful to mention the versions of Progress, Linux, PHP and so forth that you are using.
Setting that aside for now. You say that you installed the ODBC driver "no problem". To confirm that you have done so and that the problem is external to the ODBC drivers you should first try a test connection with the supplied sqlexp utility.
From a Linux command shell start "proenv". This will properly set all the needed environment. Then run "sqlexp -u username -p password -db dbname -S port#"
That should get you a prompt where you can enter SQL queries etc.
If that works then you have all of the files needed from Progress' POV and the issue would be in your ODBC setup (odbc.ini). If it does not work then you likely have a Progress/OS release mismatch.
Related
For a little while now, I've been looking how to try a connection to AS400 with Laravel 7.
I use this package : https://github.com/cooperl22/laravel-ibmi
I add laravel-ibmi to your composer.json file:
"require": {
"cooperl/laravel-ibmi": "^7.0"
}
Use composer to install this package.
$ composer update
Run on the command line from the root of my project:
$ php artisan vendor:publish
And set credentials in .env
DB_CONNECTION=ibmi
DB_HOST=********
DB_PORT=********
DB_DATABASE=********
DB_USERNAME=********
DB_PASSWORD=********
I try a connection with tinket but i have this message :
Psy Shell v0.10.4 (PHP 7.2.24-0ubuntu0.18.04.4 — cli) by Justin Hileman
>>> DB::connection();
PDOException with message 'could not find driver
I should set my credentials in app/config/db2.php, not in .env ?
UPDATE
I install the unixODBC
odbcinst -j
unixODBC 2.3.4
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/za/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
Download ibm_data_server_driver_for_odbc_cli_linux390x64_v11.5.tar.gz
tar -xavf ibm_data_server_driver_for_odbc_cli_linux390x64_v11.5.tar.gz
cd odbc_cli
sudo mkdir -p /opt/ibm/clidriver
sudo cp -r clidriver/* /opt/ibm/clidriver
Edit the odbcinst.ini
[Db2]
Description=Db2 Driver
Driver=/opt/ibm/clidriver/lib/libdb2o.so
fileusage=1
dontdlclose=1
Edit odbc.ini for the test
[sample]
Description = Test to DB2
Driver = Db2
but when i try i got this message
export DB2INSTANCE=db2inst1
isql -v sample db2inst1 ibmdb2
[01000][unixODBC][Driver Manager]Can't open lib '/opt/ibm/clidriver/lib/libdb2o.so' : file not found
[ISQL]ERROR: Could not SQLConnect
UPDATE 2
I go to https://www.ibm.com/support/pages/node/633843
Click Downloads for IBM i Access Client Solutions
When prompted, log in with my IBMid
Scroll down, and next to ACS Linux App Pkg, select Download now
After that i have installed ibm-iaccess-1.1.0.13-1.0.x86_64.rpm, i see it automatically adds the IBM i Access ODBC Driver to odbcinst.ini.
Edit odbc.ini for the test
[sample]
Description = Test to DB2
Driver = IBM i Access ODBC Driver
But it's the bug is repeated (Whereas /opt/ibm/iaccess/lib64/libcwbodbc.so exist).
isql -v sample
[01000][unixODBC][Driver Manager]Can't open lib '/opt/ibm/iaccess/lib64/libcwbodbc.so' : file not found
[ISQL]ERROR: Could not SQLConnect
UPDATE 3
I enter this command
ldd /opt/ibm/iaccess/lib64/libcwbodbc.so
linux-vdso.so.1 (0x00007ffe4830e000)
libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007f1fdc97e000)
libcwbcore.so => not found
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1fdc5f5000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1fdc257000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1fdc03f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1fdbc4e000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f1fdba44000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1fdb825000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1fdce6c000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1fdb621000)
I did that afterwards.
cp /opt/ibm/iaccess/lib64/libcwbcore.so /usr/lib/x86_64-linux-gnu/
isql -v sample
[S1000][unixODBC][IBM][Pilote ODBC System i Access]Le nom de syst�me requis pour la connexion est manquant.
[ISQL]ERROR: Could not SQLConnect
For PHP and Laravel it is wise to get the unixODBC working at the command line before trying to get it working with PHP. The reason is that troubleshooting is easier when you have fewer components to test. It also helps with separation of responsibilities.
The solution was to download and install
a suitable Db2-driver for ODBC/CLI on Linux specifically to work with i-series (AS/400) from IBM website at this link.
The other small footprint clidriver (supplied by IBM) cannot communicate with i-series unless you go via a Db2-connect gateway or have a Db2-connect licence (separate purchase). So it is usually more effective to use the IBM i access product instead. The clidriver works correctly without needing a license or Db2-connect, only when the target Db2-server runs on Linux or Unix variant or Microsoft Windows.
This IBM i access client product has a PDF document included "Installation and Usage Guide" which has helpful information, and several links to useful resources.
After installation, it is necessary to properly configure both the odbcjinst.ini (which details the driver) and the odbc.ini(which details the data soruces) (or .odbc.ini for user DSNs) for use with the driver supplied by the IBM i access client product.
Instructions for completing the odbcinst.ini and odbc.ini are available on the unixODBC website.
Test the connection to the i series with the isql tool, to verify that unixODBC is able to connect and use SQL queries.
The IBM i access product also has troubleshooting tools that includes cwbping and cwbtrc commands among others, which exercise the Db2-driver independently of unixODBC.
Once isql successfully connects to the i series database, you are now ready to configure PHP to use the driver in the normal way. You can then test with Laravel.
Remember to ensure that your linux shell sets the correct LANG environment variable to match your country and your character encoding before accessing the database (which require the relevant locale to be installed), otherwise codepage conversion may give unexpected results.
I have a Debian server (64 bits) and I want to connect it to a AS400's database through PHP. I have installed the IBM i Access for Linux and unixodbc. I have followed this tutorial: https://www.albertopicado.es/conexion-odbc-con-base-de-datos-db2-en-un-servidor-ibm-iseries/ although it's in spanish you can see the proccess I have followed.
The thing is that I can make a simple connection like:
$server= 'DRIVER={DRIVER_NAME};DATABASE=DATABASENAME;SYSTEM=IP;HOSTNAME=IP;PORT=NUMBER_OF_THE_PORT;PROTOCOL=TCPIP;';
$as400= odbc_connect($server, "username", "password");
$as400 ? echo "ok" : echo "ko";
This return 'ok' so I understand that the connection has been established. Then I make a simple odbc_prepare like the following:
$query="SELECT * FROM DATABASE.TABLE WHERE ID=1;
$result=odbc_prepare($as400,$query);
This throws me Fatal error: Allowed memory size of 1048576000 bytes exhausted (tried to allocate 140707423584261 bytes).
I have incremented the value of memory_limit on the php.ini file to 1000M and it still throws the same error. I've been surfing on internet and I found people having problems with 64 bits versions like on this post: Linux odbc Fatal error: Allowed memory size but the query I'm executing doesn't have any null value.
Info
odbcinst -j command:
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
odbcinst.ini:
[iSeries Access ODBC Driver]
Description=iSeries Access for Linux ODBC Driver
Driver=/opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup=/opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
NOTE1=If using unixODBC 2.2.11 or later and you want the 32 and 64-bit ODBC drivers to share DSN's,
NOTE2=the following Driver64/Setup64 keywords will provide that support.
Driver64=/opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup64=/opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading=2
DontDLClose=1
UsageCount=2
[iSeries Access ODBC Driver 64-bit]
Description=iSeries Access for Linux 64-bit ODBC Driver
Driver=/opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup=/opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading=2
DontDLClose=1
UsageCount=1
odbc.ini is blank.
EDIT
Seeing that maybe the iSeriesAccess Driver x64 has some bugs I finally uninstalled it. Then I installed the iSeriesAccess Driver x32. Before installing the new driver I made my Debian multiarch and I downloaded the ia32-libs (because some packages were missing for the iSeriesAccess Driver x32).
With the new driver I get another error:
Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/opt/ibm/iSeriesAccess/lib/libcwbodbc.so' : file not found, SQL state 01000 in SQLConnect.
I have double checked that the lib 'libcwbodbc.so' exists. I also run the command ldd against the lib to see if there is something missing:
linux-gate.so.1 (0xf7763000)
libcwbcore.so => /opt/ibm/iSeriesAccess/lib/libcwbcore.so (0xf7557000)
libodbcinst.so.1 => /usr/lib/i386-linux-gnu/libodbcinst.so.1 (0xf7544000)
libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xf753e000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf7522000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf7430000)
libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xf73ea000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf73cd000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf721f000)
librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xf7216000)
libltdl.so.7 => /usr/lib/i386-linux-gnu/libltdl.so.7 (0xf720a000)
/lib/ld-linux.so.2 (0xf7766000)
As you could see there aren't missing libs. What am I missing?
SOLUTION
Finally, I installed the 32 bits version of Debian. As it looked to me the problem relied on the IBM I Access Driver of 64 bits version. I just followed the same steps on the new installation and it works like a charm. Hope it helps someone else.
This is a duplicate of #21286589. Just because you do not have a NULL value doesn't mean you won't run in to problems when using a mis-matched ABI.
The problem here is that the old driver only sets 32-bits of the 64-bit indicator value and PHP reads the whole 64-bits. Here PHP sees the value 140707423584261, which is 0x7FF900000005 in hex. You can see the last 4 bytes are 0x00000005 which is 5 and should be the length of the actual data returned. The rest of it is garbage because the driver did not change those bytes.
As I mentioned in my answer for Linux odbc Fatal error: Allowed memory size, you will need to get the new ODBC driver from the IBM i Access Client Solutions Linux Application Package. This driver follows the full 64-bit ABI that unixODBC has used since 2.2.14. The new driver package also contains Debian .deb packages, so pretty much all the steps in the blog you referenced are no longer needed.
I am using eloquent outside laravel. I have my own PHP application.
This is what i am using https://github.com/illuminate/database
My config is as following
$settings3 = array(
'driver' => 'odbc',
'dsn' => "Driver={SQL Server};Server={serverName};Trusted_Connection=true;Database=telesur_mis;",
'username' => 'user',
'password' => 'user',);
$capsule->addConnection($settings3,'teleappframework');
After executing this code I am getting the following error
Fatal error: Uncaught InvalidArgumentException: Unsupported driver [odbc]
I have PDO ODBC installed, i have also tested pdo odbc connection outside of eloquent.
The reason for using ODBC is, because i am using PHP7 and currently there is no PDO extension for SQL Server.
Can anyone help me on this?
i would download FreeTDS and just use the regular sqlsrvr driver it works like a charm (if you are on a unix env) there is a lot of posts on how to configure it etc just look it up.
PHP7 has a few modules disabled by default that were previously enabled in PHP5.
Most likely running php -m does not show the modules you need.
It's an easy fix though since the extension should already exist in the \ext\ folder that came with PHP7. You just need to modify your php.ini file to include the line:
extension=php_pdo_odbc.dll
extension=php_odbc.dll
Then from a command prompt or terminal test again using php -m to see that the module is now listed.
I have a system that is running php, and I recently needed to add connectivity to an MSSQL database. I have FreeTDS and UnixODBC installed/configured correctly, and I can make successful queries in python, and via utilities like tsql and isql. After looking at phpinfo() I've discovered I don't have a 'sqlsrv' section, and there is no mssql.so file in my php extensions directory.
I want to add this to my system without having to recompile/install php. Would I be able to find and download the mssql.so file, put it into my extensions directory, add extension=/path/to/mssql.so to my php.ini file, and reload apache to get this working? Or is there more steps I would need to take?
EDIT:
The system is running SLES11 with PHP 5.2
EDIT 2:
I've managed to get the php5-mssql extension installed. I grabbed the source, extracted it, and copies these files:
ext/mssql/config.m4
ext/mssql/php_mssql.c
ext/mssql/php_mssql.h
Then, in the directory where I copied the files to, I ran phpize (you will need to install php5-devel to get this tool), and compiled the extension like so:
./configure --with-mssql=/usr/local/freetds
make
I also had to add a line and comment out a line in php_mssql.c before it could actually compile correctly (not everyone will need to do this):
{NULL,NULL,NULL}
/*PHP_FE_END*/
This created the mssql.so file in /php_mssql/modules/ (relative to where I compiled the code), which I was able to move to my extensions directory (you can find this with php -i | grep extensions). I added extension=mssql.so to my php.ini file; however, there is still no 'sqlsrv section in phpinfo().
Some connection methods seem to partially work:
When running the following code from a shell, <h1>Connection Success</h1> is shown; but when opened in a browser, nothing after the mssql_connect line is shown:
<?php
//*************************************************************************
//Open Database Connection
//*************************************************************************
//phpinfo();
$dbserver="MyServer";
$dbusername="user";
$dbpassword="pass";
$defaultdb="DBName";
$cn = mssql_connect($dbserver,$dbusername,$dbpassword) or die("Connection Error");
$db = mssql_select_db($defaultdb,$cn) or die("Database Error");
echo "<h1>Connection Success</h1>";
?>
So it looks like I'm partially getting a connection that way? When I try with a PDO object, I get another error:
Code:
<?php
$con = new PDO('odbc:host=MyServer;dbname=DBName','user','pass');
?>
Error:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified' in /path/to/php/file/test3.php:3
Stack trace:
#0 /path/to/php/file/test3.php(3): PDO->__construct('odbc:host=MySer...', 'user', 'pass')
#1 {main}
thrown in /path/to/php/file/test3.php on line 3
I've also tried the following (assuming that the PDO statement/DSN in the previous code was incorrrect):
<?php
try {
$db = new PDO("odbc:Driver=FreeTDS; Server=MyServer; Port=1433; Database=DBName; UID=user; PWD=pass;");
} catch (PDOException $exception) {
die("$exception");
}
echo "<h1>Success!</h1>";
?>
This showed <h1>Success!</h1> from the shell, but showed the following error in my web browser:
exception 'PDOException' with message 'SQLSTATE[08001] SQLDriverConnect: 0 [unixODBC][FreeTDS][SQL Server]Unable to connect to data source' in /path/to/php/file/test4.php:3 Stack trace: #0 /path/to/php/file/test4.php(3): PDO->__construct('odbc:Driver=Fre...') #1 {main}
In ODBC the error message contains elements in [] at the start of the message and the rightmost one is the part of the chain reporting the error (see ODBC Diagnostics & Error Status Codes. So, "[unixODBC][Driver Manager]Data source name not found, and no default driver specified" was reported by unixODBC. What unixODBC is saying is the string passed to the ODBC API SQLConnect or SQLDriverConnect does not identify a DSN (data source name) or an ODBC driver and there is no default DSN defined. You can find where your data sources are defined by running odbcinst -j e.g.,
$ odbcinst -j
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/martin/.odbc.ini
SQLULEN Size.......: 4
SQLLEN Size........: 4
SQLSETPOSIROW Size.: 2
Here, drivers are defined in /etc/odbcinst.ini, system data sources in /etc/odbc.ini and user data sources in /home/martin/.odbc.ini. As you'll probably be running PHP probably under a web server I'd stick to using the system data sources if I were you. You can list your system data sources with odbcinst -q -l -s. You find a a very good explanation of Linux/ODBC at Linux/UNIX ODBC.
Your second error "[unixODBC][FreeTDS][SQL Server]Unable to connect to data source" is reported by the SQL Server driver from FreeTDS so in this case you must have passed sufficient information to unixODBC to at least allow it to identify the driver, load it and call SQLConnect/SQLDriverConnect in it. You can see what was passed to unixODBC's SQLConnect/SQLDriverConnect by enabling tracing in unixODBC. You enable tracing of unixODBC by editing your odbcinst.ini file (locate with odbcinst -j command above) and adding the following to the top of it:
[ODBC]
Trace = yes
TraceFile = /tmp/unixodbc.log
Now, when you run your php example it will log to /tmp/unixodbc.log all ODBC API calls and the one you are looking for is SQLConnect or SQLDriverConnect. e.g., when I connect to a DSN called mydsn with a username and password of XXX and YYY I see:
[ODBC][31521][1374740062.012973][SQLDriverConnect.c][687]
Entry:
Connection = 0x9d7d430
Window Hdl = (nil)
Str In = [DSN=mydsn;UID=XXX;PWD=********][length = 29]
Str Out = 0xbfdeb83c
Str Out Max = 512
Str Out Ptr = 0xbfdeb638
Completion = 0
UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'
DIAG [01000] [Easysoft][SQL Server Driver][SQL Server]Changed database context to 'master'.
DIAG [01000] [Easysoft][SQL Server Driver][SQL Server]Changed language setting to us_english.
Note, this connection was successful and it clearly shows part of the connection string was DSN=mydsn and mydsn exists as a DSN in my /etc/odbcinst.ini.
isql can work differently to some ODBC enabled applications as isql calls the ODBC API SQLConnect whereas most ODBC applications these days are ODBC 3 aware and use SQLDriverConnect. The main difference is SQLConnect is only given 3 arguments, a DSN name, a username and a password where SQLDriverConnect is given a single string of attribute/value pairs defining the connection. I only tell you this so you are aware how it is possible for isql to work and something else not to.
However, in your second case when you examine your trace you'll see unixODBC got something useful enough to identify the driver, load it and call freeTDS's ODBC driver and the error "Unable to connect to data source" is coming from freeTDS. So, I suggest your DSN is probably ok and your freetds.conf is incorrect in some way. As I don't use freeTDS myself I'm not sure but I've heard you can use ODBC with freeTDS without any reference to the freetds.conf file and switches based on whether you use Server or ServerName. I'm sure there are loads of examples on the freeTDS web site.
Here's how I connect to MS SQL servers from a LAMP (Ubuntu) stack:
/etc/odbc.ini
# Define a connection to a Microsoft SQL server
# The Description can be whatever we want it to be.
# The Driver value must match what we have defined in /etc/odbcinst.ini
# The Database name must be the name of the database this connection will connect to.
# The ServerName is the name we defined in /etc/freetds/freetds.conf
# The TDS_Version should match what we defined in /etc/freetds/freetds.conf
[mssql]
Description = MSSQL Server
Driver = freetds
Database = XXXXXX
ServerName = MSSQL
TDS_Version = 8.0
/etc/odbcinst.ini
# Define where to find the driver for the Free TDS connections.
[freetds]
Description = MS SQL database access with Free TDS
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so
UsageCount = 1
/etc/freetds/freetds.conf
# The basics for defining a DSN (Data Source Name)
# [data_source_name]
# host = <hostname or IP address>
# port = <port number to connect to - probably 1433>
# tds version = <TDS version to use - probably 8.0>
# Define a connection to the Microsoft SQL Server
[mssql]
host = XXXXXX
port = 1433
tds version = 8.0
And here's the PHP code:
$con = new PDO('dblib:host=mssql;dbname=MyDB', 'domain\username', 'password');
You may need to tweak things a bit for your OS. To install the necessary software on Ubuntu I did something like this:
sudo apt-get install php5-odbc php5-sybase tdsodbc
Use PDO and instal this http://www.php.net/manual/en/ref.pdo-sqlsrv.php
I always use PDO it can easy do all the database interaction you need with different db drivers and the same php code. Except the query languages which is sometimes a little different.
For MSSQL you only need to add the drivers just paste the .dll's, add the entry to the conf.ini and restart apache.
I'm running php5 on Ubuntu10.10 server where the unixODBC and php5-odbc packages have already been installed. I keep getting an error during the connection process - code:
$data_source = 'DRIVER={Microsoft dBASE Driver (*.dbf)};Data Source=//128.251.xxx.xxx/lv_apps/AppsLON/CData/dbf/cdma';"", "");
$conn = odbc_connect($data_source, "", "");
if (!$conn)
exit("Connection Failed: " .$conn );
error message:
1 Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/vfptest.php on line 6
I added extention=dbase.so and extention=odbc.so to both files: /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini and re-compiled the php install with:
sudo ./configure --prefix=/usr --enable-dbase=shared --with-unixODBC
I've also gone to unixODBC and pecl to install the unixODBC and dbase libraries separately with no luck.
Also I found this link: http://www.devlist.com/ConnectionStringsPage.aspx
where it is stated that in order to create an ODBC connection to a foxpro database I use the line:
Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\demo.dbc;Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO
this still did not work for me however; probably because I do not have the visual foxpro driver installed or my odbc.ini file pointing to the driver path...but I don't know.
In short - odbc_connect() takes; an ODBC Data Source Name (DSN), Username & Password as per --
http://php.net/manual/en/function.odbc-connect.php
As far as I am aware there is no VFP ODBC driver for Linux so you will, most likely, need to employ an ODBC Bridge solution like -
http://uda.openlinksw.com/odbc-odbc-mt/
This has a client/server architecture --
Linux client --
php ODBC Application
OpenLink Generic ODBC Driver (thin multi-tier ODBC client)
Windows server --
OpenLink Request Broker (Multi-tier server)
OpenLInk Agent for ODBC (Multi-tier server)
Fox Pro ODBC DSN (pre configured)
Fox Pro files...
I hope this helps?
Check out the very bottom of this thread on the MSDN network
the driver line you have posted is "...an ODBC connection string which is not supported for VFP tables having a version later than 6."
Although not familiar with linux connecting to VFP, however, odbc connections for such VFP connect to a PATH, not a specific table. Once the connection to the PATH is valid, THEN you can query any .DBF table IN that location.
Although I can't answer your specific connection info, I've found this link
http://www.phpfreaks.com/forums/index.php?topic=296832.0
that shows connecting to a datasource... notice its identifying the 'DRIVER={Microsoft dBASE Driver (*.dbf)};datasource=/home/dir/file.dbf;' used... You'll probably have to hit a combination of this driver and pathing info (I'd still try WITHOUT the specific .dbf file first).
Hope this helps..