I am executing python file through php code in my local host

<?php
$out = array();
$execute='C:\wamp\bin\apache\Apache2.2.11\cgi-bin\test.py';
exec  ("$execute", $out);
foreach ($out as $value) {
    echo "$value<br />\n";
}
?>

test.py

#!/usr/bin/python
import cgi, cgitb, os, sys

cgitb.enable(); # formats errors in HTML
print "helloworld"

it correctly working in localserver

but when i hosted in webserver its not working

how can i give path of cgi-bin in my webserver

If you own the servers lets talk about how sets PHP works along with Python . If you don’t the only thing you can do is to contact the owners of the server. (To be more precise just copy fist the simple hello word for python to avoid all the troubles about the right syntax of your program)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.