Thanks a lot for your input. I have unset those variables, recompiled the DBD and installed it again. Now working fine for all users through cli. I am getting the following error when I am executing the same code through Apache web server cgi-bin:
AH01215: install_driver(Oracle) failed: Can't load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.11.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
Server version: Apache/2.4.6 (Red Hat Enterprise Linux)
Server built: May 28 2018 16:19:32
Linux ess.saildsp.co.in 3.10.0-862.14.4.el7.x86_64 #1 SMP Fri Sep 21 09:07:21 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Oracle client 11gR2
I have set ORACLE_HOME and LD_LIBRARY_PATH in /etc/sysconfig/httpd
I have also set LD_LIBRARY_PATH in /etc/ld.so.conf and executed ldconfig