
ankit
Novice
Jul 6, 2011, 12:06 AM
Post #1 of 4
(2433 views)
|
Unable to run perl-cgi script in webbrowser of Cent OS linux
|
Can't Post
|
|
Hi, I want run my perl-CGI programe in Cent Os but when i am running on browser it gives following error in Apache error log: [Wed Jul 06 12:37:41 2011] [error] [client 172.16.237.128] (2)No such file or directory: exec of '/var/www/cgi-bin/webrebase101.cgi' failed [Wed Jul 06 12:37:41 2011] [error] [client 172.16.237.128] Premature end of script headers: webrebase101.cgi My perl script is given below: #!/usr/bin/perl use Restrictionmap; use Rebase; use SeqFileIO; use CGI qw/:standard/; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use CGI qw/:standard start_table/; use strict; use warnings; print header, start_html('Restriction Map'), '<body bgcolor="#FFFFFF" text="black" link="#1F86FF" vlink="#005DC9" alink="#62A9FF" ><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><!--mstheme-->', '<center><b><font size="8" face="Bauhaus 93">Restriction Site Mapping</font></center></b>', '<LEFT><b><font size="8" face="Courier">[ REMAP ]</font></center></b><div align="right"><a href="rebase1.html"><img src="SSRIMG/home2.JPG" width="100" height="55" border="0" alt="Home" align="middle"></a><a href="cont.html"><img src="SSRIMG/contact2.BMP" width="150" height="55" border="0" alt="Feedback" align="middle"></a> </div>', start_multipart_form, i,b('<font size=3><center>'), '<body background="images-2/final.jpg">' , '<body bgcolor=white>', '<font color=black>', h3,'<A HREF="http://localhost/myscript/webrebase101.cgi">For Multiple sequence Click here</a>', h3(" Restriction enzyme(s) [case sencetive] "), textfield('enzyme'),p, h3(" Sequence filename (fasta or raw format): "), filefield(-name=>'fileseq', -default=>'starting value', -size=>50, -maxlength=>200, ), p, strong(em("or")), h3("Type sequence: "), textarea( -name=>'typedseq', -rows=>10, -columns=>60, -maxlength=>1000, ), p, h3,("View Format :"), '<input type="RADIO" name="format" value="png">PNG', '<input type="RADIO" name="format" value="jpg">JPG', '<input type="RADIO" name="format" value="text">TEXT[ For large sequence Only ]<br>', ,p, h3,("View String Frequency:"), '<input type="RADIO" name="frequency" value="base">Yes','<input type="RADIO" name="frequency" value="base">NO<br>', ,p, h3(" Make restriction map:"), submit , p, '</font>', '</body>', hr, end_form; if (param( )) { my $sequence = ''; # must have exactly one of the two sequence input methods specified if(param('typedseq') and param('fileseq')) { print "<font color=red>You have given a file AND typed in sequence: do only one!</font>", hr; exit; }elsif(not param('typedseq') and not param('fileseq')) { print "<font color=red>You must give a sequence file OR type in sequence!</ font>", hr; exit; }elsif(param('typedseq')) { $sequence = param('typedseq'); }elsif(param('fileseq')) { my $fh = upload('fileseq'); while (<$fh>) { /^\s*>/ and next; # handles fasta file headers $sequence .= $_; } } if(not param('format')){ print "<font color=red>You must give a Format name!</ font>", hr; exit; } # strip out non-sequence characters $sequence =~ s/\s//g; $sequence = uc $sequence; my $rebase = Rebase->new( #omit "bionetfile" attribute to avoid recalculating the DBM file dbmfile => 'BIONET', mode => '0444', ); my $restrict = Restrictionmap->new( enzyme => param('enzyme'), rebase => $rebase, sequence => $sequence, graphictype =>param('format'), ); print "<p>Your requested enzyme(s): ",em(param('enzyme')),p, "</p>\n"; # table start print "<table border='black'>\n"; # teable header print "<tr>\n"; # header row start foreach my $head ('Restriction Enzyme','Restriction Site','Total No. of Fragments'){ print "<th>$head</th>\n"; # header cell } print "</tr>\n"; # header row end # table content (my $paramenzyme = param('enzyme')) =~ s/,/ /g; # printing table rows within the circle foreach my $enzyme (split(" ", $paramenzyme)) { # define the values for columns here as # $seq_name, $restr_enzyme, $restr_site, $count my $restr_enzyme =$enzyme; my $restr_site = join( ' ', $restrict->get_enzyme_map($enzyme)),; my $count = join(' ', $restrict->get_enzyme_map($enzyme)+1, "\n"); # then print the table row print "<tr>\n"; # row start foreach my $value ( $restr_enzyme, $restr_site, $count ){ print "<td>$value</td>\n"; # data cell } print "</tr>\n"; # row end } # finish the table print "</table>\n"; if (param('frequency')) { my @DNA = ( ); my $base = ' '; my $count_of_A = ( ); my $count_of_C = ( ); my $count_of_G = ( ); my $count_of_T = ( ); my $errors = ( ); @DNA = split( '', $sequence); # Initialize the counts. # Notice that we can use scalar variables to hold numbers. $count_of_A = 0; $count_of_C = 0; $count_of_G = 0; $count_of_T = 0; $errors = 0; # In a loop, look at each base in turn, determine which of the # four types of nucleotides it is, and increment the # appropriate count. foreach $base (@DNA) { if ( $base eq 'A' ) { ++$count_of_A; } elsif ( $base eq 'C' ) { ++$count_of_C; } elsif ( $base eq 'G' ) { ++$count_of_G; } elsif ( $base eq 'T' ) { ++$count_of_T; } else { print "!!!!!!!! Error - I don\'t recognize this base: $base\n"; ++$errors; } } print "The Total No. of Frequency of Different Bases are \n "; print "A = $count_of_A\n"; print "C = $count_of_C\n"; print "G = $count_of_G\n"; print "T = $count_of_T\n"; print "\n\n\n"; } # lets store the image in the images subfolder # (relating to the script location) my $img_path = 'images/'; mkdir $img_path unless -d $img_path; # lets create the image name using the extension # taken from the object. the result should be 'images/tmp.png' $img_path .= 'tmp.' . param('format'); # storing the image my $img_binary = $restrict->get_graphic(); open my $img, '>', $img_path or die "can not write to $img_path: $!"; binmode $img; print $img $img_binary; close $img or die "failed to close <$img_path> $!"; print qq|<A HREF="http://localhost/myscript/images/"><input type=image src="images-2/download_file.jpg"/></A>|, ; print "<center><img src=\"$img_path\"><br/>","\n\n\n\n\n"; exit; }
|