I need to build PHP from source in order to use this customer ODBC drivers. I've followed these inspections: https://www.progress.com/tutorials/odbc/using-php and everything (including the ODBC driver) works fine when I manually start apache with /usr/local/apache2/bin/apachectl start
But when I try to start apache with systemd, the ODBC drivers no longer works.
I've created this file: /usr/lib/systemd/system/httpd.service
[Unit]
Description=Apache Web Server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/apache2/logs/httpd.pid
ExecStart=/usr/local/apache2/bin/apachectl start
ExecStop=/usr/local/apache2/bin/apachectl graceful-stop
ExecReload=/usr/local/apache2/bin/apachectl graceful
PrivateTmp=true
LimitNOFILE=infinity
[Install]
WantedBy=multi-user.target
I get the following error in my php file when starting apache with systemd:
odbc_connect(): SQL error: [DataDirect][ODBC lib] Driver Manager Message file not found. Please check for the value of InstallDir in your odbc.ini., SQL state IM002 in SQLConnect
The InstallDir is set correctly in my odbc.ini file:
I don't get this error when starting apache with apachectl start
manually.
Any suggestion on how to fix this?
I was able to resolve my issue by adding the following lines to my
/usr/lib/systemd/system/httpd.service
file, under the[Service]
section:Environment="ODBCINST=/opt/Progress/DataDirect/Hybrid_Data_Pipeline_for_ODBC/odbcinst.ini" Environment="ODBC_HOME=/opt/Progress/DataDirect/Hybrid_Data_Pipeline_for_ODBC" Environment="ODBCINI=/opt/Progress/DataDirect/Hybrid_Data_Pipeline_for_ODBC/odbc.ini" Environment="TZ=America/Los_Angeles"