PHP call from Python

Is it possible to run a PHP script using python?

+5
source share
2 answers

You can use the Python OS module . You can run any script by calling

os.system('php -f file.php')

The problem will be getting return values ​​from PHP to Python here.

+3
source

You can study the class subprocess, namelysubprocess.call()

subprocess.call(*popenargs, **kwargs)

subprocess.call(["php", "path/to/script.php"]);
+14
source

All Articles