Answer the question
In order to leave comments, you need to log in
How to correctly set environment variables for correct operation of odbc from PHP?
Hello!
There is a script that creates a class object, let's call it CPConnect.
In this class, in the constructor, the following happens:
private function set_openedge_env() {
putenv("DLC=/usr/dlc");
putenv("ODBCINST=/home/odbcinst.ini");
putenv("ODBCINI=/home/odbc.ini");
putenv("LD_LIBRARY_PATH=/usr/dlc/odbc/lib");
}
function __construct() {
$this->set_openedge_env();
if ($this->conn_id = odbc_connect($this->dsn, $this->db_user, $this->db_pass, SQL_CUR_USE_ODBC)) {
} else {
throw new Exception("Сonnect error. " . $this->conn_id);
}
}
$progressConnect = new CPConnect();
echo getenv("DLC");
/usr/dlc
odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect
phpinfo()
necessary variables are displayed in, safemode is disabled. Answer the question
In order to leave comments, you need to log in
The issue was resolved by setting the settings in php and setting the necessary rights.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question