I somehow managed resolve this now.
In my strace logs I noticed an error indicating the system was looking for the file dblgen17.res in the folder /opt/sqlanywhere17/lib64
. This file did not exist in this folder, instead it was located in the folder: /opt/sqlanywhere17/res/
I copied the filed over to /lib64. Got another error:
[08001][unixODBC][SAP][ODBC Driver][SQL Anywhere]Encryption error: Missing or invalid encryption DLL "libdbrsa17_r.so"
Did a sudo chmod 644 /opt/sqlanywhere17/lib64/libdbrsa17_r.so
and voila.
My wild guess is that apache somehow need those files to connect, while local users on the server does not.
It might not be the correct way of resolving the issue, but atleast apache can now function with ODBC as intended.