You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jayakrishnan M <ja...@gmail.com> on 2008/06/01 10:22:19 UTC

[users@httpd] cgi script fails

Hi,

I am using a shell script as a cgi script. I am trying to call an
erlang beam file from the shell script for some processing.
The problem is that the erlang code is not getting executed.
The lines in the shell script which are above and below the call to
erlang binary are working.
I have been trying to figure out the problem for a long time, but
without any success.
Can anyone help me please?

Thanks in advance.
Jayakrishnan

---------------------------------------------------------------------
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] cgi script fails

Posted by Krist van Besien <kr...@gmail.com>.
On Sun, Jun 1, 2008 at 2:43 PM, Jayakrishnan M <ja...@gmail.com> wrote:
> Got the reason.. erl interpreter is failing.
> Now I'll try to figure out why it is failing.
> Thanks for the help.

CGI scripts are run with the permissions and the environment of the
user the webserver runs as. This means that possibly some variable you
have in your own environment is missing. Have a look at what you have
in your environment and add it to your script.

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
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] cgi script fails

Posted by Jayakrishnan M <ja...@gmail.com>.
Got the reason.. erl interpreter is failing.
Now I'll try to figure out why it is failing.
Thanks for the help.

Jayakrishnan

On Sun, Jun 1, 2008 at 5:01 PM, Nick Kew <ni...@webthing.com> wrote:
> On Sun, 1 Jun 2008 16:56:13 +0530
> "Jayakrishnan M" <ja...@gmail.com> wrote:
>
>> The problem is the erlang module doesn't seem to be working when
>> called from the cgi script.
>> For testing, I put prints to stdout as well as file at the start
>> itself. But both are not happening.
>> I can't understand the reason for such a behaviour.
>
> Then I'd refer back a little more carefully to Eric Bowman's reply,
> and perhaps also try running your script under cg-eye.
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.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
>
>

---------------------------------------------------------------------
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] cgi script fails

Posted by Nick Kew <ni...@webthing.com>.
On Sun, 1 Jun 2008 16:56:13 +0530
"Jayakrishnan M" <ja...@gmail.com> wrote:

> The problem is the erlang module doesn't seem to be working when
> called from the cgi script.
> For testing, I put prints to stdout as well as file at the start
> itself. But both are not happening.
> I can't understand the reason for such a behaviour.

Then I'd refer back a little more carefully to Eric Bowman's reply,
and perhaps also try running your script under cg-eye.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.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] cgi script fails

Posted by Jayakrishnan M <ja...@gmail.com>.
The problem is the erlang module doesn't seem to be working when
called from the cgi script.
For testing, I put prints to stdout as well as file at the start itself.
But both are not happening.
I can't understand the reason for such a behaviour.

Thanks
Jayakrishnan

On Sun, Jun 1, 2008 at 4:51 PM, Nick Kew <ni...@webthing.com> wrote:
> On Sun, 1 Jun 2008 11:49:16 +0100
> Nick Kew <ni...@webthing.com> wrote:
>
>> On Sun, 1 Jun 2008 13:52:19 +0530
>> "Jayakrishnan M" <ja...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > I am using a shell script as a cgi script. I am trying to call an
>> > erlang beam file from the shell script for some processing.
>> > The problem is that the erlang code is not getting executed.
>> > The lines in the shell script which are above and below the call to
>> > erlang binary are working.
>>
>> Are you sure it's not running but just failing to send the
>> output you expect?
>>
>> What happens if you run within your script
>> erlang-prog | while read output
>> do
>>   echo "$output"
>> done
>
> Come to think of it, that still generates output in a subshell.
> A better test may be to save your program's output to a tempfile
> and then cat that back to the client.
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.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
>
>

---------------------------------------------------------------------
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] cgi script fails

Posted by Nick Kew <ni...@webthing.com>.
On Sun, 1 Jun 2008 11:49:16 +0100
Nick Kew <ni...@webthing.com> wrote:

> On Sun, 1 Jun 2008 13:52:19 +0530
> "Jayakrishnan M" <ja...@gmail.com> wrote:
> 
> > Hi,
> > 
> > I am using a shell script as a cgi script. I am trying to call an
> > erlang beam file from the shell script for some processing.
> > The problem is that the erlang code is not getting executed.
> > The lines in the shell script which are above and below the call to
> > erlang binary are working.
> 
> Are you sure it's not running but just failing to send the
> output you expect?
> 
> What happens if you run within your script
> erlang-prog | while read output
> do
>   echo "$output"
> done

Come to think of it, that still generates output in a subshell.
A better test may be to save your program's output to a tempfile
and then cat that back to the client.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.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] cgi script fails

Posted by Nick Kew <ni...@webthing.com>.
On Sun, 1 Jun 2008 13:52:19 +0530
"Jayakrishnan M" <ja...@gmail.com> wrote:

> Hi,
> 
> I am using a shell script as a cgi script. I am trying to call an
> erlang beam file from the shell script for some processing.
> The problem is that the erlang code is not getting executed.
> The lines in the shell script which are above and below the call to
> erlang binary are working.

Are you sure it's not running but just failing to send the
output you expect?

What happens if you run within your script
erlang-prog | while read output
do
  echo "$output"
done

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.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] cgi script fails

Posted by Jayakrishnan M <ja...@gmail.com>.
The erlang module works fine when I invoke it from the command line.
I have put the same command in the shell script.
I have made sure that all paths are okay.

Thanks
Jayakrishnan

On Sun, Jun 1, 2008 at 4:26 PM, Eric Bowman <eb...@boboco.ie> wrote:
> Jayakrishnan M wrote:
>>
>> Hi,
>>
>> I am using a shell script as a cgi script. I am trying to call an
>> erlang beam file from the shell script for some processing.
>> The problem is that the erlang code is not getting executed.
>> The lines in the shell script which are above and below the call to
>> erlang binary are working.
>> I have been trying to figure out the problem for a long time, but
>> without any success.
>> Can anyone help me please?
>>
>
> How are you invoking the beam file?  Most likely your PATH is set
> incorrectly.
>
> --
> Eric Bowman
> Boboco Ltd
> ebowman@boboco.ie
> http://www.boboco.ie/ebowman/pubkey.pgp
> +35318394189/+353872801532
>
>
> ---------------------------------------------------------------------
> 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] cgi script fails

Posted by Eric Bowman <eb...@boboco.ie>.
Jayakrishnan M wrote:
> Hi,
>
> I am using a shell script as a cgi script. I am trying to call an
> erlang beam file from the shell script for some processing.
> The problem is that the erlang code is not getting executed.
> The lines in the shell script which are above and below the call to
> erlang binary are working.
> I have been trying to figure out the problem for a long time, but
> without any success.
> Can anyone help me please?
>   

How are you invoking the beam file?  Most likely your PATH is set 
incorrectly.

-- 
Eric Bowman
Boboco Ltd
ebowman@boboco.ie
http://www.boboco.ie/ebowman/pubkey.pgp
+35318394189/+353872801532


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