Heads up! This post was written 15 years ago. Some information might be outdated or may have changed since then.
shell_exec('command');. Идеята е да се подкара без външни модули. За целта намираме httpd.conf файла (обикновено в "C:\Program Files\Zend\Apache2\conf" директорията), правим му резервно копие за всеки случай, отваряме го с някой текстови редактор пр. notepad. В последния ред на файла добавяме ScriptInterpreterSource Registry. А в < Directory "C:\Program Files\Zend\Apache2/htdocs" > намираме Options Indexes и му добавяме +ExecCGI като трябва да стане Options Indexes +ExecCGI и на нов ред добавяме AddHandler cgi-script .cgi .py при мен директивата изглежда по следния начин
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks +ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
AddHandler cgi-script .cgi .py
Важно е да спомена че това е един от начините за подкарване на python в уеб под Windows. Тествано е на Windows Server 2003 и Windows 7. Записваме промените по файла и рестартираме Apache сървъра. Ако има проблеми при стартирането четем лога за грешки и действаме :) За тестване дали всичко е ок след рестартирането на Apache може да използвате следния код #!c:/Python27 python
# -*- coding: UTF-8 -*-
# enable debugging
import cgitb
cgitb.enable()
print "Content-Type: text/plain;charset=utf-8"
print
print "Hello World!" като реда #!c:/Python27 python указва къде е инсталиран python :)