Python Cgi-bin Error 500
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us python internal server error 500 Learn more about Stack Overflow the company Business Learn more about hiring developers
Apache Python Cgi Internal Server Error
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack
Internal Server Error Cgi Python
Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Python CGI getting 500 Internal Server Error
Python 500 Error
up vote 0 down vote favorite I'm making first python script. I've uploaded the script in public_html/cgi-bin folder with 777 permission. I'm getting this 500 Internal server error. I've wrote the following code. #!/usr/bin/python print "Content-type: text/html\r\n" print "
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies malformed header from script python of this site About Us Learn more about Stack Overflow the company 500 python gun Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges how to fix 500 internal server error Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: http://stackoverflow.com/questions/29847127/python-cgi-getting-500-internal-server-error Sign up Python CGI throwing 500 Internal Server Error up vote 1 down vote favorite Im running a website hosted on HelioHost, I'm a 10th grade student, so I can't exactly afford to pay for hosting. I was trying to run a simple CGI Script written in python on the web server: #!/usr/bin/env python print "Content-type: text/html\n\n" print "
Hello World
" Unfortunately, I http://stackoverflow.com/questions/27340286/python-cgi-throwing-500-internal-server-error got a 500 Internal Server error at http://fpl.heliohost.org/cgi-bin/lel.py I tried replacing the shebang line with #!/usr/bin/python, as suggested at http://www.heliohost.org/home/features/languages/python, but I'm still facing the same error. chmod is 755. Also, I'm able to run this on my PC via Python Command Line, and it works fine on my Apache Web Server on my Raspberry Pi. Any idea what could be causing the problem? python apache cgi host share|improve this question asked Dec 7 '14 at 6:30 poiasd 649 Check what your web server's error log says. Use the time of the request to line up with the relevant error log entry. –Alex Reynolds Dec 7 '14 at 6:34 Unfortunately HelioHost wont let me see the error log :( But I got it working! cgi-bin chmod was 777, I changed it to 755 and it started! But I wonder why it wouldn't work with extra permissions... –poiasd Dec 7 '14 at 6:42 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote I managed to get it working by changing the permissions (chmod) of cgi-bin there for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack http://stackoverflow.com/questions/378811/getting-python-to-work-internal-server-error Overflow the company Business Learn more about hiring developers or posting ads with us https://discussion.dreamhost.com/thread-106122.html Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Getting python to work, Internal Server Error up vote 6 down vote favorite 2 I'm internal server trying to get Python scripts, called from a web browser, to work. I keep getting the error: 500 Internal Server Error When I check my error logs I see the message Premature end of script headers The only documentation of this error online says that it can be the result of having improper line return characters in your script, but I wrote my test script right from the shell with pico. internal server error Also, when I run the file from the command line it executes just fine. " So far the only change I have made to apache is to add the .py to the "AddHandler cgi-script" line. Thanks! Thanks for the quick responses. Here is the latest version of the test code. I added a couple new lines before the output as suggested but still get the same error: #!/usr/local/bin/python print "Content-type: text/html\n" print "\n\n" print "" print "
" print "Hi there.
" print "" print "" Some other details: I am running Apache 1.3 and don't have mod_python. I set apache to recognize .py as mentioned above. I am running the script from the main public_html folder. An update. It doesn't seem to matter what I put in the shebang line. I tried all of the suggestions and even if I leave it blank the same error is showing up in the errors log and I'm getting a 500 error. I'm running Apache/1.3.41 on linux (red hat 3.4) with WHM/Cpanel installed. python share|improve this question edited Oct 5 '11 at 2:09 Bill the Lizard 223k139449737 asked Dec 18 '08 at 18:53 user47514 31112 add a comment| 12 Answers 12 active oldest votes up vote 10 doError500 with a python script! Pages (2): 1 2 Next » Threaded Mode | Linear Mode Error500 with a python script! 05-06-2008, 03:28 AM Post: #1 Mitheor Dreamling Posts: 1 Joined: May 2008 Error500 with a python script! Hi, i was trying to use a python script but it always returns an 500 internal server error. The script is very simple. I have tried to use the example of the the dreamhost wiki but it doesnt work either. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #!/usr/bin/python def main(): print "Content-type: text/html" print print "
" print "