2 Answers
+ 3
i think its possible using popen ( https://www.php.net/manual/en/function.popen.php ), but i never actually tried it with python.
+ 2
there are many scenarios to cover this.
in addition to the above post.
you can use exec() to execute a python script, how that script returns data is where you have to decide.
+ could write to a file and then parse it with php.
+ returns an array
+....
try this on sololearn PHP code playground.
<?php
$test = exec("ls -l") ;
echo $test
?>
it would execute ls command and return the result to $test.
ps:you can use python for backend.