Jump to content

Cgi Python Script Help


Recommended Posts

Try this:

 

whatever.cgi

#!/usr/bin/python
print "Content-Type: text/html"
print
print "Hello World"

 

Two things I noticed, you didn't give an extra space after Content-Type (either using \n, or print), and you don't really need charset=utf-8

 

The error log inside of cpanel tells you (kinda) why the page failed, always start there. If my solution doesn't work, copy and paste the last 10 or so lines from your error log so I see what's going on.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

I'm stuck with the same problem. I created an account on "stevie", who is supposed to be able to run python. now i put a small .cgi file with 755 permissions into the cgi-bin folder (also 755) and used the code you guys posted above. unfortunately i'm getting an internal server error (500). am i missing something here? or does it take a while until everything works on a new account?

Link to comment
Share on other sites

"stevie", who is supposed to be able to run python.

Python is working fine on Stevie.

or does it take a while until everything works on a new account?

Python should work as soon as you can see your site in a browser. So generally 24 hours or less after your account is created.

 

If you actually want some help with this you should post a link to your test file.

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...