ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I connected postgreSQL database with perl using code given below
But this code is working only from command prompt & when I am logged in to postgreSQL.
But I want to view the o/p in Netscape. I am using Apache 2.0.40 & Redhat9 OS. Pls make the required modification in code. or if I have to do some enviornment setting tell me.
I am typeing http: //localhost /cgi-bin/beers.pl in Netscape.
Code is as follows.
#!/usr/bin/perl
# beers.pl - my first perl data base script!
use DBI;
$dbh = DBI->connect('dbi:Pg:dbname=test', 'postgres', 'post');
$sth = $dbh->prepare("SELECT * from statename");
$rv = $sth->execute;
while (my @row_ary = $sth->fetchrow_array)
{print " $row_ary[0] $row_ary[1]\n";}
$sth->finish;
undef $sth;
$dbh->disconnect;
undef $dbh;
I tried the code given by u. But when I tried to run it by http://localhost/cgi-bin/beers.pl I was unable to see any o/p in browser. but a single straight line was displayed at the line one of browser. Remember I am able to connect perl to Postgre only when I am on postgre prompt not from anywhere else.
Following is the file /var/log/httpd/error_log.
But I am not getting what to do now.
[Sun Mar 28 15:38:50 2004] [notice] Digest: generating secret for digest authentication ...
[Sun Mar 28 15:38:50 2004] [notice] Digest: done
[Sun Mar 28 15:38:51 2004] [notice] Apache/2.0.40 (Red Hat Linux) configured -- resuming normal operations
[Sun Mar 28 17:39:26 2004] [warn] child process 2205 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:26 2004] [warn] child process 2206 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:26 2004] [warn] child process 2207 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:26 2004] [warn] child process 2208 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:26 2004] [warn] child process 2209 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:26 2004] [warn] child process 2210 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:26 2004] [warn] child process 2211 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:26 2004] [warn] child process 2212 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:27 2004] [warn] child process 2205 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:27 2004] [warn] child process 2206 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:27 2004] [warn] child process 2207 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:27 2004] [warn] child process 2208 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:27 2004] [warn] child process 2209 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:27 2004] [warn] child process 2210 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:27 2004] [warn] child process 2211 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:27 2004] [warn] child process 2212 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:28 2004] [warn] child process 2205 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:28 2004] [warn] child process 2206 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:28 2004] [warn] child process 2207 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:28 2004] [warn] child process 2208 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:28 2004] [warn] child process 2209 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:28 2004] [warn] child process 2210 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:28 2004] [warn] child process 2211 still did not exit, sending a SIGTERM
[Sun Mar 28 17:39:28 2004] [warn] child process 2212 still did not exit, sending a SIGTERM
[Mon Mar 29 15:49:27 2004] [notice] Digest: generating secret for digest authentication ...
[Mon Mar 29 15:49:27 2004] [notice] Digest: done
[Mon Mar 29 15:49:28 2004] [notice] Apache/2.0.40 (Red Hat Linux) configured -- resuming normal operations
[Mon Mar 29 15:51:53 2004] [error] [client 127.0.0.1] Premature end of script headers: emp.pl
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.