Jump to content

[Solved] Python Cgi


chlorella2006

Recommended Posts

Hi,

 

I created a file main.py in /public_html/cgi-bin

 

#!/usr/bin/python
print "Content-Type: text/html\n\n"
print "Hello World"
But I got following error, anyone can help me?
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@sw.heliohost.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

 

 

 

Link to comment
Share on other sites

The error is because you're using dos line endings, and this is a linux server. The easiest way to fix this is to create the file through cpanel filemanager using the code editor and copy/paste your code in. This will ensure that your file has the correct line endings. Another option is to use a windows editor that understands proper line endings such as notepad++.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...