Jump to content

Python and Plesk


Recommended Posts

Hi, since migration to plesk some Python cgi scrips stopped to work.

I have to do some extra configuration or Python is disabled?

I have the following test script in this address https://luan.heliohost.org/cgi-bin/example.py


print ("Content-type:text/html\r\n\r\n")
print ('<html>')
print ('<head>')
print ('<title>Hello Word - First CGI Program</title>')
print ('</head>')
print ('<body>')
print ('<h2>Hello Word! This is my first CGI program</h2>')
print ('</body>')
print ('</html>')



Link to comment
Share on other sites

  • luanfrj changed the title to Python and Plesk

Hi Krydos,

I added the .htaccess file, but Python still not working.

In the same dir a Perl CGI script work https://luan.heliohost.org/cgi-bin/teste.pl and even a C one https://luan.heliohost.org/cgi-bin/teste_cgi.cgi

10 hours ago, Krydos said:

Create an .htaccess file with the contents

Options +ExecCGI
AddHandler cgi-script .py



Link to comment
Share on other sites

Python on Linux requires unix line endings. Your line endings were in Windows/DOS format. I changed them to unix endings and it works now.

If you're editing on Windows, my suggestion is to use an editor like Notepad++. You can author files using Unix endings using Edit->EOL Conversion->Unix in that editor.

Edited by wolstech
Editing on Windows
  • Thanks 1
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.

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