posfan12
posfan12

Reputation: 2651

Unable to execute Python script on web server

I have the following HTML file located in the /test folder of my website:

<!DOCTYPE html>
<html lang="en">
<body>
    <h1>Enter the texts to be compared</h1>
    <form action="/cgi-bin/test_python.cgi" method="POST">
    <input type="text" name="text1">
    <input type="text" name="text2">
    <input type="submit" name="my-form" value="Check !">
    </form>
</body>
</html>

I have this Python script located in the /cgi-bin folder of my website:

#!/usr/bin/python   
print('Content-type: text/html\r\n\r')

I am able to access the HTML file using a web browser, but pressing the "Check!" button results in a 404 message. The CGI file has 755 execute permissions assigned to it.

This is shared hosting, so I don't know for sure what features are installed or not. But CGI should at least work. I am new to Python. Is there a way to get this setup to work? Thanks.

Upvotes: 0

Views: 157

Answers (1)

Ahmad Bilal
Ahmad Bilal

Reputation: 382

Check that the cgi-folder itself (not talking about python cgi file) has 755 permissions as well. I think that is the problem here.

Also, try running a sample perl cgi Hello World file: https://practicalperl5.blogspot.com/2014/02/hello-world.html

Upvotes: 1

Related Questions