How to test for python support in a web host

Guillermo Siliceo Trueba picture Guillermo Siliceo Trueba · Jul 22, 2011 · Viewed 8.3k times · Source

Hello a client of mine bought a pretty bad web host and i don't even have ssh access, their ticket suport only answered with "yes we support python in our servers" but i can't run any .cgi .py or application.wsgi files. is there a sure way to tell if the server supports python? I only have access to the ftp and the directadmin interface, i would like to know more before i can complaing again to their support system otherwise they will not pay attention.

The host is neubox.net this is what i already tried. This tutorial http://www.howtoforge.com/embedding-python-in-apache2-with-mod_python-debian-etch worked on my dev machine, it says that i need to add a webhost in the apache2 /available-sites dir but obviously i don't have access to that folder in the hosting. I also tried putting this script on the root of my host, called application.wsgi it didnt work

import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I also tried this file application.py on the root

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print "Content-Type: text/plain;charset=utf-8"
print

print "Hello World!"

Those files were shown as plain text, i tried that exact same code but named application.cgi and oddly enough it returned a 404 error, the file of course its there. I saw at the directadmin interface in site summary that CGI-Bin OFF So i guess thats the reason for the 404. In the same page i see that the name servers are http://ns115.neubox.net/ http://ns116.neubox.net The first one says Apache is functioning normally This is their services comparison site (spanish) http://neubox.net/comparativo-hosting.php

I wish i could know what OS are they running i'm almost sure is linux because on my root there is a folder .htpasswd and those .folders are linux for hidden, but i'm not sure if thats a sure way to tell.

They gave me this url http://72.249.55.33/info.php its for phpinfo() i see fast-cgi but all the tuts about it talk about doing things like changing Apache configuration wich i obviously can't do, this is the end of my search right? they do not support python.

Answer

sacabuche picture sacabuche · Jul 23, 2011

In your server thay sais that they have php, so maybe you can use this php function. to retrive more info, executing a python script:

# hacking.py
import sys
print sys.version_info

and after you make something like this

<?php
// echo $path = exec('pwd');

// exec python script
echo exec('python hacking.py');
?>

dont forget the file permissions