You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by vijay <vi...@greatLodge.com> on 2003/07/09 03:33:41 UTC

[users@httpd] Peoblem executing an Executable

Hi All,

Iam using Apache2.0.46 on Windows XP. I've converted a  perl CGI script  to executable (sample.pl to sample.exe) . When i run
this executable on one PC it works but when i run this on the other PC with same configurations it's not working. If i execute
plain CGI it works,but if i convert it to executable it's not working. Do i need to set anything in the webserver config file?
The same executable works on one PC.


Thanks in advance.

Thanks
Vijay


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Peoblem executing an Executable

Posted by vijay <vi...@greatLodge.com>.
Robert,

it works!!!!

All i did was to run windows update on the 2nd PC(IBM ) to bring it to current
patch level.

Thanks a lot for ur time.
Vijay

with Andersson wrote:

> vijay wrote:
> > Yes. They r exactly same. Same ActivePerl 5.8, Apache 2.0.46 and PAR .0.67
> > (used to create the executable) and Windows XP . Only difference i can
> > think of is 1st PC is built by us and 2nd PC is from IBM.
> > ...snip...
> > I copied the httpd.conf file from 1st PC to 2nd PC. eventhen no use :(
> > ...snip...
> > Yes, i cud execute Perl scripts but cud not execute the compiled one.
>
> But the compiled version executes correctly from the command line, right?
> And, there is no more information available in the error log?
>
> At least, Apache is succeeding in executing the program, but it fails to
> emit the proper headers. If it do this when you run it from the command
> line, and doesn't when run through CGI, it might be due to the slightly
> different environment experienced by the program when it is executed through
> CGI. A guess is that your program hits an error, and outputs an error
> message or exit()s, before emitting the correct headers (eg. Content-type:
> ...). Isn't there anything more in the error log?
>
> So, in the end, I don't think this is an Apache issue; it's likely a Perl or
> PAR issue. If the original script itself is not misbehaving, eg. by
> outputting something before the header(s), it is probably PAR's/perl's
> run-time that does it. Try to compile a very simple Perl script, and see if
> it works:
>
> #!/usr/bin/perl
> print "Content-Type: text/html\n\n";
> print "Hello World!";
>
> If not, I'd guess something is seriously wrong with PAR. If it does, you
> need to go forth from there and see at what point it is failing; perhaps
> when using some external module or something like that.
>
> Regards,
> Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Peoblem executing an Executable

Posted by vijay <vi...@greatLodge.com>.
Robert,


Even the simple perl script did'nt work. I'm trying to install new version of
PAR. Let's see how it goes :)

Thanks again..

Vijay

Andersson wrote:

> vijay wrote:
> > Yes. They r exactly same. Same ActivePerl 5.8, Apache 2.0.46 and PAR .0.67
> > (used to create the executable) and Windows XP . Only difference i can
> > think of is 1st PC is built by us and 2nd PC is from IBM.
> > ...snip...
> > I copied the httpd.conf file from 1st PC to 2nd PC. eventhen no use :(
> > ...snip...
> > Yes, i cud execute Perl scripts but cud not execute the compiled one.
>
> But the compiled version executes correctly from the command line, right?
> And, there is no more information available in the error log?
>
> At least, Apache is succeeding in executing the program, but it fails to
> emit the proper headers. If it do this when you run it from the command
> line, and doesn't when run through CGI, it might be due to the slightly
> different environment experienced by the program when it is executed through
> CGI. A guess is that your program hits an error, and outputs an error
> message or exit()s, before emitting the correct headers (eg. Content-type:
> ...). Isn't there anything more in the error log?
>
> So, in the end, I don't think this is an Apache issue; it's likely a Perl or
> PAR issue. If the original script itself is not misbehaving, eg. by
> outputting something before the header(s), it is probably PAR's/perl's
> run-time that does it. Try to compile a very simple Perl script, and see if
> it works:
>
> #!/usr/bin/perl
> print "Content-Type: text/html\n\n";
> print "Hello World!";
>
> If not, I'd guess something is seriously wrong with PAR. If it does, you
> need to go forth from there and see at what point it is failing; perhaps
> when using some external module or something like that.
>
> Regards,
> Robert Andersson
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Peoblem executing an Executable

Posted by Robert Andersson <ro...@profundis.nu>.
vijay wrote:
> Yes. They r exactly same. Same ActivePerl 5.8, Apache 2.0.46 and PAR .0.67
> (used to create the executable) and Windows XP . Only difference i can
> think of is 1st PC is built by us and 2nd PC is from IBM.
> ...snip...
> I copied the httpd.conf file from 1st PC to 2nd PC. eventhen no use :(
> ...snip...
> Yes, i cud execute Perl scripts but cud not execute the compiled one.

But the compiled version executes correctly from the command line, right?
And, there is no more information available in the error log?

At least, Apache is succeeding in executing the program, but it fails to
emit the proper headers. If it do this when you run it from the command
line, and doesn't when run through CGI, it might be due to the slightly
different environment experienced by the program when it is executed through
CGI. A guess is that your program hits an error, and outputs an error
message or exit()s, before emitting the correct headers (eg. Content-type:
...). Isn't there anything more in the error log?

So, in the end, I don't think this is an Apache issue; it's likely a Perl or
PAR issue. If the original script itself is not misbehaving, eg. by
outputting something before the header(s), it is probably PAR's/perl's
run-time that does it. Try to compile a very simple Perl script, and see if
it works:

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "Hello World!";

If not, I'd guess something is seriously wrong with PAR. If it does, you
need to go forth from there and see at what point it is failing; perhaps
when using some external module or something like that.

Regards,
Robert Andersson




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Peoblem executing an Executable

Posted by vijay <vi...@greatLodge.com>.
Robert,

> vijay wrote:
> > Both servers or configured same. no difference at all. I use ScriptAlias.
> I did
> > not use ExecCGI.
>
> Are they *exactly* the same, or just approximately the same? How about the
> environment (paths, etc). Is it also the same on both systems?

Yes. They r exactly same. Same ActivePerl 5.8, Apache 2.0.46 and PAR .0.67
(used to create the executable) and Windows XP . Only difference i can think of
is 1st PC is built by us and 2nd PC is from IBM.


>
>
> > Without using ExecCGI it working on my 1st PC.
> >
> > When tried to run the executable on the 2nd PC i got the error "Premature
> end
> > of script headers" then
> > i installed Active perl , and the module i used to make excutable. And i
> > created the executable on 2nd pc, then also i got the same error message.
>
> Um, as I interpret your first message, you could execute the Perl script on
> both systems, but it was the compiled (executable) version that failed on
> the second system. Does what you say here mean that you cannot execute any
> CGIs on the second system? If you can, you need start out with "hello world"
> and build up until you see where it fails.
>
> If you cannot execute any CGIs, even precomiled, and I trust you have done
> proper configuration, I'm sorry to say, I do not know what is causing this
> behaviour. My final suggestions are:
>
> *) Check all paths in httpd.conf and verify that they are valid on
>    the second machine.

I copied the httpd.conf file from 1st PC to 2nd PC. eventhen no use :(

>
>
> *) Check your CGI script/executable and verify any paths or utilities
>    they rely on. For the Perl script, verify that the shebang points
>    to the perl interpreter on your system.

Yes, i cud execute Perl scripts but cud not execute the compiled one.

Thanks a lot for ur time.
Vijay

>
>
> Regards,
> Robert Andersson
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Peoblem executing an Executable

Posted by Robert Andersson <ro...@profundis.nu>.
vijay wrote:
> Both servers or configured same. no difference at all. I use ScriptAlias.
I did
> not use ExecCGI.

Are they *exactly* the same, or just approximately the same? How about the
environment (paths, etc). Is it also the same on both systems?

> Without using ExecCGI it working on my 1st PC.
>
> When tried to run the executable on the 2nd PC i got the error "Premature
end
> of script headers" then
> i installed Active perl , and the module i used to make excutable. And i
> created the executable on 2nd pc, then also i got the same error message.

Um, as I interpret your first message, you could execute the Perl script on
both systems, but it was the compiled (executable) version that failed on
the second system. Does what you say here mean that you cannot execute any
CGIs on the second system? If you can, you need start out with "hello world"
and build up until you see where it fails.

If you cannot execute any CGIs, even precomiled, and I trust you have done
proper configuration, I'm sorry to say, I do not know what is causing this
behaviour. My final suggestions are:

*) Check all paths in httpd.conf and verify that they are valid on
   the second machine.

*) Check your CGI script/executable and verify any paths or utilities
   they rely on. For the Perl script, verify that the shebang points
   to the perl interpreter on your system.


Regards,
Robert Andersson




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Peoblem executing an Executable

Posted by vijay <vi...@greatLodge.com>.
Robert Andersson wrote:

> vijay wrote:
> > If i execute plain CGI it works, but if i convert it to executable it's
> not
> > working.
>
> I understand that the problem arises when executing it through CGI, correct?
> By 'plain CGI', do you mean a [Perl] script? In regards to CGI, a binary is
> just as plain, if not plainer, than an interpreted script.
>

Yes..problem comes when i execute it as CGI. if i execute it on command prompt
it works.

>
> > Do i need to set anything in the webserver config file?
> > The same executable works on one PC.
>
> Well, how is the other server configured?
>
> However, I'd check the CGI configuration on the failing server. Do you use
> ScriptAlias or Options ExecCGI for the directory in which the executable
> resides?

Both servers or configured same. no difference at all. I use ScriptAlias. I did
not use ExecCGI.

Without using ExecCGI it working on my 1st PC.

When tried to run the executable on the 2nd PC i got the error "Premature end
of script headers" then
i installed Active perl , and the module i used to make excutable. And i
created the executable on 2nd pc, then also i got the same error message.

Thanks a lot
Vijay

>
>
> If you use the latter method, you may need to modify this directive to
> include the .exe extension:
>
>     AddHandler cgi-script .cgi .pl .exe
>
> Regards,
> Robet Andersson.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Peoblem executing an Executable

Posted by Robert Andersson <ro...@profundis.nu>.
vijay wrote:
> If i execute plain CGI it works, but if i convert it to executable it's
not
> working.

I understand that the problem arises when executing it through CGI, correct?
By 'plain CGI', do you mean a [Perl] script? In regards to CGI, a binary is
just as plain, if not plainer, than an interpreted script.

> Do i need to set anything in the webserver config file?
> The same executable works on one PC.

Well, how is the other server configured?

However, I'd check the CGI configuration on the failing server. Do you use
ScriptAlias or Options ExecCGI for the directory in which the executable
resides?

If you use the latter method, you may need to modify this directive to
include the .exe extension:

    AddHandler cgi-script .cgi .pl .exe


Regards,
Robet Andersson.




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org