Python Cgi Internal Server Error
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 Learn more about Stack Overflow the company Business Learn more about
Python Internal Server Error 500
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask apache python cgi internal server error 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 end of script output before headers python them; it only takes a minute: Sign up internal server error (500) in simple cgi script up vote 7 down vote favorite 1 I am trying to run a simple cgi script after configuring my server. My script looks
Malformed Header From Script Python
like this: print "Content-type: text/html" print print "
500 Python Gun
Port 80 python apache cgi share|improve this question asked Sep 23 '09 at 8:33 flybywire 65k146336457 add a comment| 6 Answers 6 active oldest votes up vote 18 down vote accepted You might need a #!/usr/bin/python at the top of your script to tell Apache to use Python to execute it. At least, I did that and it worked for me :-) . share|improve this answer answered Sep 23 '09 at 8:44 Paul Stephenson 31.4k73645 thank you, it works. –flybywire Sep 23 '09 at 8:45 I think add #!/usr/bin/python to all cgi script is scary. How to set it by apache SetEnv PYTHONPATH? –gonjay Mar 10 '15 at 9:21 add a comment| up vote 8 down vote Also, save the file (if this is a Linux server) with Unix line endings. You did make it executable using chmod +x didn't you? You can use #!/usr/bin/env python to cover the current running Python version if you're running in various environments (hence the env part). share|improve this answer edited Mar 25 '15 at 19:02 answered Sep 23 '09 at 8:53 Dave Everitt 6,40612862 When I tried it without chmod +x there was a different error: (13)Permission denied: exec of '/home/flybywire/www/cgi-bin/main.py' failed. –Paul Stephenson Sep 23 '09 at 8:58 That's simply because chmod +x makes the file permissions executable - making the file executable is a prerequisite, really. &ndash
Error500 with a python script! Pages (2): 1 2 Next » Threaded Mode | Linear premature end of script headers Mode Error500 with a python script! 05-06-2008, 03:28 AM Post: #1
How To Fix 500 Internal Server Error
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 http://stackoverflow.com/questions/1464728/internal-server-error-500-in-simple-cgi-script the the dreamhost wiki but it doesnt work either. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" #!/usr/bin/python def main(): print "Content-type: text/html" print print "
" print "Get Kubuntu Get Xubuntu Get Lubuntu Get UbuntuStudio Get Mythbuntu Get Edubuntu Get Ubuntu-GNOME Get UbuntuKylin Ubuntu Code of Conduct Ubuntu https://ubuntuforums.org/showthread.php?t=1751674 Wiki Community Wiki Other Support Launchpad Answers Ubuntu IRC Support AskUbuntu Official Documentation User Documentation Social Media Facebook Twitter Useful Links Distrowatch Bugs: Ubuntu PPAs: Ubuntu Web Upd8: Ubuntu OMG! Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login Advanced Search Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] internal server Apache Python cgi-bin - help Having an Issue With Posting ? Do you want to help us debug the posting issues ? < is the place to report it, thanks ! Results 1 to 7 of 7 Thread: Apache Python cgi-bin - help Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid internal server error Mode Switch to Threaded Mode May 7th, 2011 #1 Scattered View Profile View Forum Posts Private Message First Cup of Ubuntu Join Date May 2011 Beans 8 Apache Python cgi-bin - help I cannot seem to get my python files to execute under Apache. Here is what I have so far: Apache works. The default page under /var/www renders in a browser. Python is loaded and works under /etc/bin/python. I have execute permissions set on /var/www/cgi-bin and my test.py file. My /etc/apache2/sites-available/default file is this: