Let me preface this by saying I don't have a lot of experience with LAMP environment. I get around but I have crashed the server a couple times poking around. That said...
I'm installing the NetSuite 64bit ODBC driver on an Ubuntu 14.04.4 box on AWS. I also have the Windows driver which I tried using a WAMP setup. On the WAMP setup on my desktop, I can get the connection to work and can query the NetSuite database. On the server, the ODBC driver is set up properly and I have been able to get it to work using isql using the odbcisql64 that is provided by NetSuite.
ISQL> connect "usr"*"pwd"@netsuite
SQL: connecting to database: netsuite...
Elapsed time 1336 ms.
This means that the DSN is set up properly. When I run the PHP code to access the database using the driver, I get this error:
Fatal error: Call to undefined function odbc_connect() in /var/www/html/www.xxxxx.com/xxxx/GetNSData_1.php on line 5
My PHP code looks like this:
error_reporting(E_ALL);
ini_set('display_errors', '1');
$conn = odbc_connect("NetSuite", "usr", "pwd");
if (!$conn) {
die(' Could not connect: ' . odbc_error());
}
$query = odbc_prepare($conn, "Some Query");
$success = odbc_execute($query, array('Data'));
if($success)
odbc_result_all($query);
So this means that there is a missing package on the LAMP server. I'm not sure exactly sure which ones to install. I've tried a whole bunch including unixODBC and FreeTDS. When I install these packages, I get a different error that says this:
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/html/www.xxxxx.com/xxxxxx/GetNSData_1.php on line 6
After fixing the linkage in the odbcinst command to be sure that the driver is installed, then I get an error that tells me nothing. There's no error code or anything- not even an odbc_error() response:
Warning: odbc_connect(): SQL error: [unixODBC], SQL state in SQLConnect in /var/www/html/www.xxxxx.com/xxxxxx/GetNSData_1.php on line 5
Could not connect:
So What I suspect is happening is that some path is not getting to the driver anymore. I've tried things online like this: http://www.debugthat.com/connecting-to-netsuite-using-linux-and-odbc but I'm missing something. I know it has to do with the configuration but I'm not knowledgeable enough to see what I'm missing.
If anyone could give me some help on this I would be eternally grateful! Thanks!