How to add Python to Apache handler?

Status
Not open for further replies.

bryanda

New Member
Messages
5
Reaction score
0
Points
0
Do I need to upload mod_python before adding to apache handler?
Where should I upload to?
There are two text box: Handler and extension(s).
I try to put "mod_python" as my handler and ".py" as my extension(s), but still doesn't work.

Or without uploading mod_python, can i run my .py files?

Please help me. Thanks alot.
 

zubair12

Banned
Messages
631
Reaction score
0
Points
0
You just go to your cpanel and go to apache handler. There you have two feilds one for name and one for extension. in name field type python and in extension field type .py !!!!
You don`t need to upload the mod..
 
Last edited:

bryanda

New Member
Messages
5
Reaction score
0
Points
0
Thanks alot for your help.

I add already User Defined Apache handlers with "python" and ".py".

I have my py file code as below:
(1)
from python import apache
def handler(req):
req.log_error('handler')
req.content_type = 'text/html'
req.send_http_header()
req.write('<html><head><title>Testing python</title></head><body>')
req.write('Hello World!')
req.write('</body></html>')
return apache.OK

I try a simple code below as well but cannot work too.
(2)
#!/usr/bin/env python
import cgi
print "Content-Type: text/html \r\n\r\n"
print "Hello, World!"

May I know must I put inside cgi-bin?
Is there any problem with the code above?

My link is as below:
http://sllib.x10hosting.com/cgi-bin/hello6.py
http://sllib.x10hosting.com/cgi-bin/helloworld.py

Looking forward for your help, thanks in advance...
 
Status
Not open for further replies.
Top