UPDATE: should be on serverfault as suggested. New post here: https://serverfault.com/questions/451220/psql-64bit-driver-error
I am having a hard time getting PHP to connect with ODBC using a Pervasive SQL driver.
I have an Ubuntu Server 12.04 and have installed the 64bit PSQL Client drivers from here: http://www.pervasivedb.com/psqlv11/Pages/PSQL-v11-Linux-Downloads.aspx
I have setup my ODBC.ini with the DSN to my database, and I can happily connect and then run queries:
isql Exchequer
When I use PHP, odbc_connect looks OK and gives me a resource, but odbc_exec (the point at which the driver is called) then totally fails (SEG fault):
[Fri Aug 10 11:05:50 2012] [notice] child pid 13770 exit signal Segmentation fault (11)
What am I doing wrong?
UPDATE:
Here is the output from gdb
(gdb) run /var/www/default/scripts/stock/index.php
Starting program: /usr/bin/php5 /var/www/default/scripts/stock/index.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffecc89700 (LWP 14514)]
[Thread 0x7fffecc89700 (LWP 14514) exited]
Halt[Inferior 1 (process 14513) exited normally]
(gdb) bt
No stack.
And the PHP error.log entry
[Fri Aug 10 15:24:53 2012] [notice] child pid 14510 exit signal Segmentation fault (11)
I also added in the Trace/TraceFile but I don't seem to get any output saved to the log file.
Update 2:
This is the simplified script I am running:
if(!$odbc = odbc_connect("exchequer","username","password")) { die("Connection to Exchequer failed"); } $rows = odbc_exec($odbc,'SELECT sl.slStockCode, sl.slQtyInStock, sl.slQtyAllocated , sl.slLocCode FROM StockLocation sl WHERE sl.slLocCode IN (\'DIG\',\'WOO\',\'MEN\')'); echo "
".print_r($rows,true)."";
The odbc_connect works (doesn't die) but I keep seeing error 342 in my browser, and "exit signal Segmentation fault" in the apache log files.