Jump to content

[Solved] First easy basic standard Python CGI


theil

Recommended Posts

I try to write an easy basic CGI in python and get this Internal server error 500.

 

What am I doing wrong?

 

user/script theil.heliohost.org/cgi-bin/hello-get.py on johnny

 

just a "Hello World"

 

#!/usr/bin/python[LF]

print("Content-Type: text/html\n\n")[LF]

print("Hello")[LF]

 

+ The [LF] are the right line endings with notepad++.

+ I changed the permissions on Windows to everyone.

 

Why can´t it just work...

 

Thanks in advance!

 

Andy

Link to comment
Share on other sites

Finally. Set permissions to 755, now it works. Why? Don't ask me. But hope others will find this helpful.

 

-> set to 755 in cpanel/file manager (no write world/group)

-> use notepad ++ in windows, just lf no cr

 

Solved so far. Thnx.

Link to comment
Share on other sites

If it's anything like what causes this for php, it's because of the group attribute (the second number in the permissions). The files cannot be writable by the group.

 

It'd be a bad idea from a security standpoint to have stuff writable by the public too, unless it's something meant for that, like a folder for public file uploads.

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