11 Replies Latest reply on Mar 8, 2011 5:58 PM by user4528285

    DBD and Oracle

      I would like to run a perl script that needs a dbi database connection.
      When I ran my perl program using the command line:
      perl perlprogramname.pl
      It worked fine.
      But when I ran the program using webserver apache,
      I got the error message: Internal Server Error.
      The following error message was found in the log file:

      install_driver(Oracle) failed: Can't load '/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.10.1: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm
      Compilation failed in require at (eval 4) line 3.
      Perhaps a required shared library or dll isn't installed where expected
      at /home/username/public_html/cgi-bin/test.pl line 32
      [Fri Jul 14 13:43:13 2006] [error] [client] Premature end of script headers: /home/username/public_html/cgi-bin/test.pl
      [Fri Jul 14 13:43:13 2006] [error] [client] File does not exist: /usr/local/apache/htdocs/favicon.ico

      A perl program containing no dbi connection can be run without errors using webserver.
      Can someone please help me?
        • 1. Re: DBD and Oracle
          Was your ORACLE_HOME set when you compiled it? Also, if you're using instant client you have to link $ORACLE_HOME/lib/libclntsh.so to $ORACLE_HOME/lib/libclntsh.so.10.1 to make it work.
          • 2. Re: DBD and Oracle
            Can you tell me how to link $ORACLE_HOME/lib/libclntsh.so to $ORACLE_HOME/lib/libclntsh.so.10.1

            I entered:
            ln -s libclntsh.so.10.1 libclntsh.so

            I got the message:
            ln: 'libclntsh.so': File exists


            Message was edited by:
            • 3. Re: DBD and Oracle
              Ivan Kartik
              cd $ORACLE_HOME/lib
              ln -s libclntsh.so.10.1 libclntsh.so
              For more info about ln command type
              man ln
              ins shell.
              • 4. Re: DBD and Oracle
                Also, I added

                /app/oracle/oracle/product/10.2.0/client_1/lib to the /etc/ld.so.conf file.

                After running /sbin/ldconfig, I got the message:

                /sbin/ldconfig: /app/oracle/oracle/product/10.2.0/client_1/lib/libexpat.so.0 is not a symbolic link
                • 5. Re: DBD and Oracle
                  Also, what's different about your Apache perl environment compared to your normal perl environment?

                  You say the script works except when you run it in Apache...
                  • 6. Re: DBD and Oracle
                    The script does work in Apache when it does not need a database connection.
                    It does not work when it requires a dbi connection.
                    But when I run the program (with dbi connection) using command line perl test.pl, it works.
                    • 7. Re: DBD and Oracle
                      That's why I asked... could Apache be pointed to an old/embedded/module version of perl?

                      • 8. Re: DBD and Oracle

                        I am able to run a program with database connection now.

                        Sorry, I have other problem:

                        The DocumentRoot in the httpd.conf is stated as
                        DocumentRoot "/var/www/html"
                        Normally, the html contains some data. But when I checked it on my linux, I saw that it is an empty directory. Is it correct?
                        I need to mention that there is probably 2 versions of apache on the machine (2.0 and 1.3.)

                        I have an array "resultArray" of large data retrieved from the database. When I want to output elements of this array on the HTML page, I saw "Transfer data from http://....". After 5 minutes, some HTML components were gone, and no data could be displayed on the screen. And also no error messages were shown.
                        In the log file I saw the following message:
                        "The timeout specified has expired: ap_content_filter: apr_bucket_read() failed"

                        If I replace the resultArray array with another array that contains a small dataset. I works fine. I can display the data on the HTML page.

                        Do you think because some information are missing in the /var/www/html DocumentRoot?
                        • 9. Re: DBD and Oracle
                          If you're using perl, most likely your scripts need to be in cgi-bin.

                          I'm not sure as to the specifics of how to tune Apache for perl so that the timeout lasts longer than that, but I know it can be done. I have upload scripts that I use for moving archives around that don't time out after 3 hours.

                          • 10. Re: DBD and Oracle
                            hi, user7274639
                            I have the same issue: connecting the db via dbi in perl script at command works. However, when i tried to execute the same script from command line, it is not working - the error msg like
                            ' install_driver(Oracle
                            ) failed: Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
                            /auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.11.1: cannot op
                            en shared object file: No such file or directory at /usr/lib64/perl5/5.8.8/x86_6
                            4-linux-thread-multi/DynaLoader.pm line 230.

                            Looks like you have met the same thing before and you were able to fix this. Could you please
                            let me know how to make DBI connection to db works from cgi scripts?

                            Thank you very much.

                            • 11. Re: DBD and Oracle
                              Add the $ORACLE_HOME/lib to /etc/ld.so.conf.d and after run ldconfig

                              Edited by: user4528285 on 8-mar-2011 9.57