Programming Python with an EasyPHP server?

2k views Asked by At

How would I be able to configure EasyPHP to use the Python CGI? I have been trying to find information on this for the past while to no avail.

1

There are 1 answers

0
garej On BEST ANSWER

If you have Python 2.7 and EasyPHP 14.1 installed, you may go to the EasyPHP folder ../binaries/apache/cgi-bin/ (where, by the way, you may already have printenv.pl file which is the same stuff for Perl programming).

Create a .py file, let it be printenv.py, with the following content:

#!E:/Python27/python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

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

(In my case E:/Python27/ is the folder where Python installed, so it shoud be changed accordingly.)

In a browser enter: 127.0.0.1/cgi-bin/printenv.py. (The localhost reference may differ but /cgi-bin/printenv.py part remains.) Than you should see in your browser:

Hello World!

For more information, please, visit Web Python .

It is also recommended to use mod_wsgi instead of CGI technique.