Jump to content

Recommended Posts

Posted

I have a Python CGI script that I've put in my public_html folder. I set 755 permissions and the header is correct. But when I go to it in my Web browser, it doesn't execute the script; it displays it! How can I fix this?

Posted
Post the script here.

It's not terribly interesting.

 

#!/usr/bin/python
print "Content-type: text/html"
print
print "<html>"
print "<center>Hello World!</center>"
print "</html>"

Posted

I don't actually code with python, but it looks like you're missing this after the crunchbang:

# -*- coding: UTF-8 -*-

Posted

Try adding this to your htaccess file:

 

AddHandler python-program py
AddType application/python py

 

You may need to refresh on that file you were testing after you add that.

 

 

 

 

Posted

I wasn't quite sure what you meant by "refresh on the file", but I reuploaded it and reset 755 permissions. And it still displays the script instead of executing it. Is there anything else I can do?

Posted
I wasn't quite sure what you meant by "refresh on the file", but I reuploaded it and reset 755 permissions. And it still displays the script instead of executing it. Is there anything else I can do?

 

I have no knowledge of python scripting. djbob will have to help you with this.

 

 

 

Posted
I don't actually code with python, but it looks like you're missing this after the crunchbang:

# -*- coding: UTF-8 -*-

This.

Posted
I don't actually code with python, but it looks like you're missing this after the crunchbang:

# -*- coding: UTF-8 -*-

This.

I already did that.

Posted

CHMOD the following to 755:

1) The directory holding the script and .htaccess file.

2) The .htaccess file.

3) The Python script.

Posted
CHMOD the following to 755:

1) The directory holding the script and .htaccess file.

2) The .htaccess file.

3) The Python script.

 

Correct me if I'm wrong djbob, but shouldn't the permissions for the htaccess file ALWAYS be 644? Isn't it just a text file that's read and not executed?

 

 

 

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...