ehsangh
ehsangh

Reputation: 331

Running python script from php

I am trying to run a python script from php.

exec("../cgi-bin/form.py", $output);
var_dump($output);

I'm certain the path is correct, and that form.py is executable.

this is form.py

#!/usr/bin/env python
print "IN form.py'

However, this prints out NULL. I don't think the script is being executed. How do I make sure it is?

Upvotes: 2

Views: 10141

Answers (1)

Marcus Recck
Marcus Recck

Reputation: 5063

You're literally just typing in the location of the file. You need to tell exec to execute python with that script.

exec("python ../cgi-bin/form.py", $output);

Upvotes: 4

Related Questions