44 users online (1 members and 43 guests)  

Thread: DBI and Apache


  Results 1 to 14 of 14

Related

  1. Replies: 0
  2. Replies: 1
  3. Replies: 2
  4. Need help on Apache Installation Please    Forum: PHP Forum
    Replies: 2
  5. Apache Server Software?    Forum: General Discussion
    Replies: 3
  1. #1
    butterfly's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2006
    Posts
    7

    DBI and Apache

    Hi,
    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:
    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?
    Thanks

  2. #2
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: DBI and Apache

    If running on Unix/Linux:

    1.) Does the first line contain #!/usr/bin/perl (or whatever your path to perl is)?
    2.) Does the script run as such: ./perlprogramname.pl ?

    If you continue to have problems, post a copy of the script.

    The favicon.ico does not matter. It is the name of the small graphic that is displayed on the left side of the address bar. (i.e. for this site, there is an oval with a red line through it.) They are easy to make. I believe that they are .bmp's but I'm not sure. It's been a while since I made one.


    U

  3. #3
    butterfly's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2006
    Posts
    7

    Re: DBI and Apache

    Sorry, I should have mentioned that I could run a perlscript that has no dbi connection using apache.
    Errors occur only when using a dbi connection
    The complete error messages are:
    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 111.2.111.111] Premature end of script headers: /home/username/public_html/cgi-bin/test.pl
    [Fri Jul 14 13:43:13 2006] [error] [client 111.2.111.111] File does not exist: /usr/local/apache/htdocs/favicon.ico

  4. #4
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: DBI and Apache

    I assume from the DBI problem that you're trying to connect to a database.

    First thing we need to do is update your Perl dependancies. From the command prompt:

    root@host: ~# cpan

    It may ask you a bunch of questions before it compiles and installs new/updated tools.

    Now you should be up to speed. The next thing we need to do is install the Oracle api:

    cpan> install DBD::Oracle

    If all goes well, everything will compile and install. I use MySQL, so I would have to

    install DBD::mysql

    hth

    U
    Last edited by uthus; 07-17-2006 at 02:04 PM.

  5. #5
    butterfly's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2006
    Posts
    7

    Re: DBI and Apache

    Thanks for your help.
    I did install DBD on the linux using cpan.
    A friend told me that I needed to add
    /app/oracle/OraHome_1/lib
    in the oracle.conf located in the ld.so.conf.d
    Unfortunately, I could not find the directory ld.so.conf.d
    ------------------
    I tried to install DBD again.
    When I ran make DBD::Oracle, the following message was displayed
    Your LD_LIBRARY_PATH env var is set to ' '
    WARNING: Your LD_LIBRARY_PATH env var doesn't include '/app/oracle/oracle/product/10.2.0/client_1/lib' but probably needs to.
    How can I set LD_LIBRARY_PATH environment?
    Last edited by butterfly; 07-17-2006 at 02:39 PM.

  6. #6
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: DBI and Apache

    What flavor are you running?

    For Slack10.2, you would add it to /etc/ld.so.conf as such:

    Code:
    # /etc/ld.so.conf
    #
    /usr/local/lib
    /usr/X11R6/lib
    /usr/i486-slackware-linux/lib
    /opt/kde/lib
    /usr/lib/qt/lib
    /app/oracle/OraHome_1/lib
    then run ldconfig as root to link the libs.

    hth

    U
    Last edited by uthus; 07-17-2006 at 07:22 PM.

  7. #7
    butterfly's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2006
    Posts
    7

    Re: DBI and Apache

    Hi,
    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

  8. #8
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: DBI and Apache

    Before you try any of this, does libexpat.so* exist in the location you need? If so, is there a dead simlink pointing to libexpat.so? On my machine at the console (not a term window) dead links show up as red. I don't know how konquerer or any other file manager would show them. My box is console only. I have an unsupported video card that tends to lock up the system.

    If there is no libexpat.so* in the location, try this:

    locate libexpat.so.0

    or

    cd / ; find -name libexpat.so.0*

    This should give you a path to any occurance of the lib. For me, the files are:

    /usr/lib/libexpat.so.0
    /usr/lib/libexpat.so.0.5.0

    What I've done on occasion with mixed results is this:

    ln -s /real/path/to/lib/libexpat.so.0.5.0 /desired/path/to/lib/libexpat.so.0

    i.e.:

    ln -s /usr/lib/libexpat.so.0.5.0 /app/oracle/oracle/product/10.2.0/client_1/lib/libexpat.so.0

    I link to this file because that's what /usr/lib/libexpat.so.0 links to.

    Remember to ldconfig.

    hth

    U

  9. #9
    butterfly's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2006
    Posts
    7

    Re: DBI and Apache

    Hi,
    Thanks a lot for your help.
    I am able to run a program with database connection.
    Sorry, I have other problem:
    When I run the subroutine below without the block marked in red color, it works fine.
    But when I add that block to the subroutine, the following message occurs:
    Use of uninitialized value in join or string at /home/usrname/public_html/cgi-bin/test.pl

    sub getPdbidAndData{
    my $temp;
    my $string;

    for (my $index=0; $index<@pdbidQueryResult; $index++){
    if($index == 0){
    push(@pdbidResult, $pdbidQueryResult[$index]);
    $string = $dataQueryResult[$index];
    }
    if($pdbidQueryResult[$index] ne $temp && $index != 0){
    push(@dataResult, $string);
    $string = $dataQueryResult[$index];
    push(@pdbidResult, $pdbidQueryResult[$index]);
    }
    if($index == @pdbidQueryResult-1){
    push(@dataResult, $string);
    }
    if($pdbidQueryResult[$index] eq $temp){
    $string = join("\n", $string, $dataQueryResult[$index]);
    }

    $temp = $pdbidQueryResult[$index];
    }
    }

    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.)
    Thanks for your help.

  10. #10
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: DBI and Apache

    For the section in red try this:

    if($pdbidQueryResult[$index] eq $temp){
    $string = "\n " . $string . $dataQueryResult[$index];
    }



    I don't remember if there is a difference in where DocumentRoot lies between the versions. I know that on my box, and again I run Slackware, httpd.conf points to /var/www/htdocs. That directory does contain data: index.html.en, index.html.es, etc. Those are the files that used when you hit my box without using /~user.

    You can make DocumentRoot be whatever you want.

    hth

    U

  11. #11
    butterfly's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2006
    Posts
    7

    Re: DBI and Apache

    I found out that the join function is fine. The problem lies on the dataQueryResult array. This array contains a large dataset. When I 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.
    If I replace the dataQueryResult 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?

  12. #12
    butterfly's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2006
    Posts
    7

    Re: DBI and Apache

    Even though no error message was displayed, I saw the following message in the log file:
    "The timeout specified has expired: ap_content_filter: apr_bucket_read() failed"

  13. #13
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: DBI and Apache

    I've got no idea what that could be. I've never seen it in any of my logs.

    U

  14. #14
    jkk's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2006
    Posts
    8

    Re: DBI and Apache

    The favicon has nothing to do with it. Check directory permissions and file permission on the database. Remember that going through the web server it isn't executing as you... Good luck



Tags for this Thread