#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    5
    Rep Power
    0

    running jython on apache


    hi mark,
    u r probably working on Linux. My problem is, I am on windows, so when I need to specify the path to python interpreter, its, #!/python23/python. Similarly the path to jython interpreter is #!/jython-2.1/jython.
    The file with path to python interpreter works fine, however the second file doesn't.
    Any idea abt what the problem can be. The line to be interpreted is rather simple, its:- print "<p>This is a test</p>"

    Regards,
    Manish
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69

    Windows


    On the contrary, im running a windows box (but yes I also have a Linux server) and #!/usr/bin/env jython works fine, as does #!/usr/bin/env python and perl. Have you tested the Jython interpriter? i.e. run the interpriter through MSdos. If that works then have a look at the Apache error log, maybe that could give you some useful info?

    I'm not sure about this but if you go into the Jython directory there should be a registry file, if you double click that then Jython should be found by #!usr/bin/env, if it isn't been found already

    Hope this is some help,

    Mark.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    5
    Rep Power
    0
    Hi mark,
    I have tried running Jython scripts with the method u suggested, i.e.; replacing path with /usr/bin/env Jython as header. The scripts run fine, when I do so from the prompt. However, when I run them from the explorer, Netscape, an error creeps in, which is:

    /usr/bin/env: jython: Permission denied
    [Fri Jun 13 15:51:58 2003] [error] [client 127.0.0.1] Premature end of script headers: /usr/local/apache/cgi-bin/mv.py

    When I change path with the complete path to the jython interpreter, a new error crops up , which is:

    [Fri Jun 13 16:00:57 2003] [error] (13)Permission denied: exec of /usr/local/apache/cgi-bin/mv.py failed
    [Fri Jun 13 16:00:57 2003] [error] [client 127.0.0.1] Premature end of script headers: /usr/local/apache/cgi-bin/mv.py


    Can u suggest a way out.



    P.S. I am now running the scripts on a Red hat Linux now.

    Regards,
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69

    HTTP Headers


    Hi Manish,

    The error which says "Premature end of script headers" seems to be taking about http headers(?), if it is then all you should need to do is add a new line after the content-type header.

    i.e. print 'Content-Type: text/html\n'

    That should fix that error and hopefully the first too..

    Could you post a copy of what your trying to run so I could take a look?

    Mark
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    5
    Rep Power
    0
    Hi,
    these are the scripts that I was trying to run.
    The first scripts generates the first error that I had specified in my previous mail.

    #!/usr/bin/env jython

    print "Content-Type: text/plain\n\n"
    print ""
    print "Manish\n"


    the following scripts generates the second error:

    #!/root/jython-2.1/jython

    print "Content-Type: text/plain\n\n"
    print ""
    print "Manish\n"


    Regards,
  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69

    Permission denied


    I've been thinking about your problem, but the only thing I can imagin the error is being caused by has something to do with Permissions, try chmoding the file to 755, which is what a CGI file has to be inable to run on my webhost.

    Also i'd try changing your Apache config file so that CGI can be run outside the CGI-BIN directory. you can do this by comenting out this line ScriptAlias /cgi-bin/ "path to cgi-bin"

    I've only done a little work with Linux so I dont know what else to suggest being a Linux newbe, maybe ask this question in the Apache section of this forum?

    Mark

IMN logo majestic logo threadwatch logo seochat tools logo