I'm running apache2 web server on raspberry pi3 model B. I'm setting up smart home running with Pi's and Uno's. I have a php scrypt that executes python program>index.php. It has rwxrwxrwx >I'll change that late becouse i don't fully need it.
 And i want to real-time display print from python script.
 exec('sudo python3 piUno.py') Let's say that output is "Hello w"
How can i import/get printed data from .py?
First make sure you have permissions to write read execute  for web user.
You can you user sudo sudo chmod 777 /path/to/your/directory/file.xyz
For php file and file you want to run. $output = exec('sudo pytho3 piUno'); echo $output;
Credits ---> Ralph Thomas Hopper
get python to print/return value on your website with php