python - malformed header from script index.py Bad header -


i want run python code in apache2(ubuntu 14.04) server. have followed these steps , getting error:

step 1:

configuration 1: have created directory , file under

/var/www/cgi-bin 

configuration 2 : have edited /etc/apache2/sites-available/000-default.conf

alias /cgi-bin /var/www/cgi-bin <directory "/var/www/cgi-bin"> options indexes followsymlinks execcgi addhandler cgi-script .cgi .py allow </directory>  <directory /var/www/cgi-bin> options </directory> 

step 2:

and python script is: index.py

#!/usr/bin/env python import cgi; import cgitb;cgitb.enable()  print "content-type: text/plain\n"  print "<b>hello python</b>" 

step 3:

when ran through chrome browser using: url : http://localhost/cgi-bin/index.py

step 4:

i getting error in error-log

malformed header script 'index.py': bad header: hello python 

you should end header \r\n, must print out yet \r\n signal body coming.

(in other words, it's interpreting body header because headers never terminated)


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -