Python programming with EasyPHP server?

How can I configure EasyPHP to use Python CGI? I've tried to find information on this in the past, to no avail.

+3


source to share


1 answer


If you have Python 2.7 and EasyPHP 14.1 installed , you can go to the EasyPHP folder ../binaries/apache/cgi-bin/

(where, by the way, you may already have a printenv.pl

file that is the same stuff for Perl programming).

Create a file .py

, 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/

, this is the folder where Python is installed, so it should be changed accordingly).



In your browser, enter: 127.0.0.1/cgi-bin/printenv.py

. (The link localhost

may differ, but /cgi-bin/printenv.py

remains.) What 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 the CGI technique.

+3


source







All Articles