Python Cpanel 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 500 internal server error python cgi Us Learn more about Stack Overflow the company Business Learn more about hiring apache python cgi internal server error developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the python 500 error 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 Basic python script giving Internal Server
End Of Script Output Before Headers Python
Error up vote 2 down vote favorite I'm using hostgator and they swear that python is supported, but I've yet to see one working python script. I've tried several scripts, my latest one is the one they give on their website: #!/usr/bin/python print "Content-type: text/html\n\n"; print "
"; print "Test page using Python
"; print ""; I'm getting an Internal Server Error: http://elkuzu.com/cgi-bin/test.py The 500 python gun file has 755 permissions, so does the folder cgi-bin. They refused to help me with what they call "coding" problems... but with all that I've tried and received nothing but Internal Server Errors, I'm thinking the problem is with them. Anyone know what could be wrong? Error Logs: [Sat May 19 09:11:38 2012] [error] [client 74.129.48.242] File does not exist: /home/elkuzu/public_html/404.shtml [Sat May 19 09:11:38 2012] [error] [client 74.129.48.242] File does not exist: /home/elkuzu/public_html/favicon.ico [Sat May 19 09:11:37 2012] [error] [client 74.129.48.242] File does not exist: /home/elkuzu/public_html/500.shtml I've talked with my host (hostgator) and they've turned it into a ticket, which makes me think that something is up on their end. python share|improve this question edited May 19 '12 at 14:31 asked May 19 '12 at 14:04 Samir 2,08131937 What do the logs say? –Burhan Khalid May 19 '12 at 14:05 I couldn't seem to find the logs, where can i go to see them? cpanel? –Samir May 19 '12 at 14:08 Yes, cpanel look for Apache Error logs. –Burhan Khalid May 19 '12 at 14:08 [Sat May 19 09:11:38 2012] [error] [client 74.129.48.242] File does not exist: /home/elkuzu/public_html/4Up All Content All Content This Topic This Forum Advanced Search Browse Forums Chat Staff Online Users More Activity All Activity My Activity Streams Unread Content Content I Started Search More More More All how to fix 500 internal server error Activity Home VlexoFree Hosting VlexoFree Support Resolved Simple Python Script Gives HTTP500 Internal Server Error Sign in to follow this Followers 0 Simple Python Script Gives HTTP500 Internal Server Error Started by mishmash, January 21, 2012 python cgi 500 9 posts in this topic mishmash 0 Newbie Members 0 9 posts Posted January 21, 2012 (edited) · Report post Hello I have a simple python script I am trying to execute but when I access http://stackoverflow.com/questions/10665830/basic-python-script-giving-internal-server-error the file I get a HTTP500 error. Do I have the wrong Python Shebang? - The python file has the permissions: 7,5,5 - Following VlexoFrees advice I have looked at my .htaccess file & its empty so it cant be misconfigured(although maybe I need to configure it for python scripts?) - I have looked at the CPanel error logs but the 500 error isn't documented, it does show/record errors if I try to access the cgi-bin dir, http://vlexoforums.com/topic/11181-simple-python-script-gives-http500-internal-server-error/ ie, I go to www.selectrecipes.tk/cgi-bin/ - The python file should simply print out: "test" The file is here: http://www.selectrec...cgi-bin/test.py The contents of the file are simply: #!/usr/bin/python2.7 print "content-type: text/html \n\n" print "test" Edited January 21, 2012 by mishmash Share this post Link to post Share on other sites Eli L 132 VlexoFree Owner Owner 132 9,096 posts LocationWashington, USA Posted January 22, 2012 · Report post The path is /usr/bin/python [/CODE] Click your test link again and it works. Share this post Link to post Share on other sites mishmash 0 Newbie Members 0 9 posts Posted January 22, 2012 (edited) · Report post Thanks lol I like your debugging message Edited January 22, 2012 by mishmash Share this post Link to post Share on other sites mishmash 0 Newbie Members 0 9 posts Posted January 23, 2012 (edited) · Report post I am now unable to access/run the script main.py. The weird thing is that main.py contains exactly the same execution code as test.py, but when I access main.py I get a HTTP500 error? I have tested the file & it has no errors so it should execute. Why does this happen? http://www.selectrecipes.tk/cgi-bin/main.py The contents of main are: #!/usr/bin/python2.7 import sqlite3 print "Content-Type: text/plain\n\n" print "Eli is awesome" print sqlite3.connect("test.db") """#!/usr/bin/python2.7 import db.AutoBlogDatabase print "content-type: text/html \n\n" print "Worked" d = db.AutoBlogDatabase.AutoBl
Plans & Pricing Partners Support Resources Preview Forums Forums Quick Links Search Forums New Posts Search titles only Posted by Member: Separate names with a comma. Newer Than: Search this thread only https://forums.cpanel.net/threads/python-cgi-scripts.17694/ Search this forum only Display results as threads More... Useful Searches Recent Posts Resources http://www.inmotionhosting.com/support/website/error-numbers/500-internal-server-error Resources Quick Links Search Resources Most Active Authors Latest Reviews Feature Requests Defects Menu Log in Sign up The Community Forums Interact with an entire community of cPanel & WHM users! cPanel Forums > cPanel & WHM® (for Linux® Servers) > General Discussion > This site uses cookies. By continuing to use this site, you internal server are agreeing to our use of cookies. Learn More. python cgi scripts? Discussion in 'General Discussion' started by oderland, Dec 5, 2003. oderland Well-Known Member PartnerNOC Joined: Dec 30, 2002 Messages: 103 Likes Received: 0 Trophy Points: 16 Location: Kungsbacka, Sweden how do we let our users to use cgi scripts made in python ? Did a test but did not get any result in a browser . internal server error date.cgi #!/usr/bin/python #==============================================================# # Date and Time # Programmed by James Bekkema, email mail@tempestsw.com. # Copyright 2003, James Bekkema. No part of this code may be reused without permission. # See ReadMe file for more information #==============================================================# #=============EDIT HERE=============# # Select format to display the time/date: format = "%d/%m/%y, %H:%M" #=============STOP HERE=============# import cgi import time print "Content-Type: text/html\n" displayTime = time.strftime(format, time.gmtime(time.time() - time.timezone)) print 'document.write("%s");\n' % displayTime ========================================== the url is: http://ehpc.se/date.py any clue? I can run this script i a shell btw //Jack #1 oderland, Dec 5, 2003 dmuey Member Joined: Nov 25, 2003 Messages: 9 Likes Received: 0 Trophy Points: 1 It seems that apache is not configured to execute .py as a python script ( like .pl is executed as a Perl script). You would need to set up apache to do this. I actually have a thread asking about how to customize apache in a cpanel safe way. The thing that threw me off at first wast that you said at the top it was date.cgi bu the url is date.py! Anyway for the fatsest fix: - edit your httpd.conf to have .py executed as python scripts. - everytime you update apache make sure those changes are
DOMAINS WEB DESIGN WEB DESIGN SERVICES CREATE YOUR OWN WEBSITE SITE HOSTING TOOLS MEET US MEET US ABOUT US PARTNERS & AWARDS BLOG WE'RE HIRING CONTACT US AMP LOGIN SUPPORT CENTER Search Support Center Product Guides Dedicated Hosting Reseller Hosting KnowledgeBase Website Email Domain Names Reseller Billing Community Support Browse Questions Ask a Question User Submitted Articles Education Channels Android BoldGrid cPanel DokuWiki Drupal 7 Drupal 8 Everything Email Joomla 2.5 Joomla 3.1 K2 Magento 1.6 Mambo MediaWiki Moodle Movable Type OpenCart OpenCart 2.0 osCommerce PHP-Fusion PHP-Nuke phpBB phpList Premium Website Builder PrestaShop 1.5 PrestaShop 1.6 SMF Tiki Wiki VirtueMart 3 Web Hosting Manager Website Design WordPress Tools & Resources Email Configuration Blacklist Check Visual DNS Lookup Quick Tagger Icon Sets Favicon Generator Bounce Back Parser What is my IP address? >>Website .htaccess (17)Adobe Flash (2)APIs (2)Backup and Restore (15)Billing (8)Browser Issues (2)Connecting to a Database (5)cPanel (26)cPanel Account Management (16)Cron Jobs (4)Cube Cart (2)Database Setup (5)Database Troubleshooting (6)Domain Management (2)Dreamweaver (12)Drush (2)eCommerce (7)Elasticsearch (4)Fantastico (4)File Management (16)File Manager (6)FTP (10)FTP Client Setup (21)General Server Setup / Management (15)Getting Started Guides (18)Ghost (3)Google Tools (21)How To (23)HTML (2)Image Editing (2)IP Addresses (3)iWeb (1)JavaScript (2)Joomla (10)Joomla 2.5 (36)Koken (11)Linux (27)Logaholic (5)Magento (2)Maintaining Your Website (1)Managing Files (7)Microsoft FrontPage (11)Microsoft Publisher (1)ModSecurity (7) MODx (3)New Customers (7)Open Classifieds (1)PCI Compliance (7)PHP (15)PHP Configuration (7)PHP Troubleshooting (6)phpBB (25)phpMyAdmin (10)Premium Website Builder (22)Prestashop (1)Protecting Files (5)Publishing Your Site (2)Python (1)Re