473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Premature end of script

rajiv07
141 100+
Hi to all this is the code i am using to do some task but it gives the following error.i am breaking my head why the error is coming please help me on this.

The Error in log file.

(2)No such file or directory: exec of '/var/www/cgi-bin/xone/query/store_login.pl' failed

Premature end of script headers: store_login.pl


The Script

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. use CGI;
  3. use DBI;
  4. use CGI::Carp qw(fatalsToBrowser);
  5. use CGI::Cookie;
  6.  
  7. my $cgi=new CGI;
  8.  
  9. my  $cStore_Id=$cgi->param('storeid');
  10.  
  11. my $cUser_Name=$cgi->param('username');
  12.  
  13. my $cPassword=$cgi->param('password');
  14.  
  15. my $cSite=$ENV{'HTTP_HOST'};
  16.  
  17. my $cPrev=$ENV{'HTTP_REFERER'};
  18.  
  19. if($cPrev=~/$cSite/)
  20. {
  21. }
  22. #else
  23. #{
  24. #print "Content-type:text/html\n\n";
  25. #print "You Cannot View this Page";
  26. #exit;
  27. #}
  28.  
  29. my $dbh=DBI->connect('dbi:mysql:xone:localhost','root','') or die "cannot connect to the database $DBI::errstr";
  30.  
  31. if(($cStore_Id eq "")&&($cUser_Name eq "")&&($cPassword eq ""))
  32. {
  33.  &_showForm();
  34. exit;
  35. }
  36.  
  37. my $cStr="select xstore_managerinfo.username,xstore_managerinfo.password from xstoreinfo,xstore_managerinfo where xstoreinfo.storeid=\'$cStore_Id\' and xstore_managerinfo.password=\'$cPassword\' and xstore_managerinfo.username=\'$cUser_Name\' and xstore_managerinfo.storeid=xstoreinfo.storeid";
  38.  
  39. my $cSth=$dbh->prepare($cStr);
  40.  
  41. $cSth->execute();
  42.  
  43. @aTemp=$cSth->fetchrow_array;
  44.  
  45. if($aTemp[0] eq "")
  46. {
  47. &_showErrorPage();
  48. exit;
  49. }
  50.  
  51. my $server = $ENV{'HTTP_HOST'} ;
  52.  
  53. my $path = "/" ;
  54.  
  55. print "Set-Cookie: manager\=$cUser_Name; path\=$path;\n";
  56.  
  57. print 'Status: 302 Moved', "\r\n",'Location:/cgi-bin/xone/query/billgenerate.pl', "\r\n\r\n";
  58.  
  59. sub _showForm
  60. {
  61. #my $cStr="select storeid from xstoreinfo where storeid=\'1123\'";
  62. #
  63. #my $cSth=$dbh->prepare($cStr);
  64. #
  65. #$cSth->execute();
  66. #
  67. #@aTemp=$cSth->fetchrow_array;
  68.  
  69. my $cFile="../templates/store_login.html";
  70.  
  71. my $cTemplate=_ReadFile($cFile);
  72.  
  73. #$cTemplate=~ s/__STOREID__/$aTemp[0]/ig;
  74.  
  75. my $cMain_File="../templates/store_template.html";
  76.  
  77. my $cMain_Template=_ReadFile($cMain_File);
  78.  
  79. $cMain_Template=~ s/__STORE_BILL__/$cTemplate/;
  80.  
  81. print "Content-type:text/html\n\n";
  82. print $cMain_Template;
  83. return; 
  84. }
  85.  
  86. sub _ReadFile
  87. {
  88. my $cFile=shift;
  89.  
  90. open(IN,"$cFile");
  91.  
  92. my $cTemp=$/;
  93.  
  94. undef $/;
  95.  
  96. my $cOut=<IN>;
  97.  
  98. $/=$cTemp;
  99.  
  100. undef $cTemp;
  101.  
  102. close(IN);
  103.  
  104. return $cOut;
  105. }
  106.  
  107. sub _showErrorPage
  108. {
  109. my $cFile="../templates/error_page.html";
  110.  
  111. my $cTemplate=_ReadFile($cFile);
  112.  
  113. my $cMain_File="../templates/store_template.html";
  114.  
  115. my $cMain_Template=_ReadFile($cMain_File);
  116.  
  117. $cMain_Template=~ s/__STORE_BILL__/$cTemplate/;
  118. print "Content-type:text/html\n\n";
  119. print $cMain_Template;
  120. return;
  121. }
Actually this script is running successfully on some other server.But i try to run in my new server it gives that error.
Thanks
RajivGandhi
Feb 15 '08 #1
0 1118

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Seagull Manager | last post by:
Running Apache 1.3, PHP 4.3, and WinXP, configured acc. to instructions on apache manual and php manual (as far as I can see), but getting "internal server error" in browser... log says "Premature...
1
by: Jason Ho-Ching | last post by:
Can anyone tell me about this error I am getting? Premature end of script headers: main.php Thanks! ##-----------------------------------------------## Article posted from PHP Freaks...
0
by: Greeshma | last post by:
Hi all, I have successfully configured Apache 2.0.4 with RedHat 7.3 and use Python 2.2.3 for cgi scripts. When I start Apache manually through /usr/local/apache/bin/apachectl startssl, I can...
1
by: Jatinder Singh | last post by:
I am running a CGI Programme. which is throwing Premature script error for some inputs. I have checked and couldn't fig out the problem. Even error log is empty. Can anybody help me out of this...
1
by: Wayne Deleersnyder | last post by:
Hi, I'm a newbie at Perl and CGI and hoping someone can point me in the right direction. Recently I've been going through an older book I have on CGI programming to get a start. Most of it...
5
by: Erich Schreiber | last post by:
In the Python Library Reference the explanation of the time.sleep() function reads amongst others: > The actual suspension time may be less than that requested because > any caught signal will...
5
by: kardon33 | last post by:
Im getting these errors when i use a module, could anyone tell me what they think wrong, its the second one that i think it the problem but i don't know what it means so i cant fix it, Thank you. ...
1
by: Christoph Burschka | last post by:
I have compiled PHP 5.2.3 as a CGI binary, and this works. I can, for example, do the following: $ php.cgi hello_world.php X-Powered-By: PHP/5.2.3 Content-type: text/html Hello World! ===
3
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.