Skip to content

Instantly share code, notes, and snippets.

@zzjin23
Last active August 29, 2015 14:03
Show Gist options
  • Save zzjin23/2eb3af0123ae4b194539 to your computer and use it in GitHub Desktop.
Save zzjin23/2eb3af0123ae4b194539 to your computer and use it in GitHub Desktop.
Execute PHP using Python
import subprocess
# if the script don't need output.
subprocess.call("php /path/to/your/script.php")
# if you want output
proc = subprocess.Popen("php /path/to/your/script.php", shell=True, stdout=subprocess.PIPE)
script_response = proc.stdout.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment