0

It works when execute from IDLE and Console, but when I trigger python script from PHP the PiCamera won't work.

import picamera from PiCamera
from time import sleep

camera = PiCamera()
camera.start_preview()
camera.capture('/home/pi/Pictures/image.JPEG')
camera.stop_preview()
camera.close()
<?php
    $command = escapeshellcmd('python3 /home/pi/Downloads/code.py');
    $output = shell_exec($command);
    echo $output;
?>
Simon
  • 1
  • 1
  • Is there some form of error message to go along with it or does it simply not do anything? – TomMP Nov 25 '19 at 09:31
  • https://stackoverflow.com/questions/20124327/php-shell-exec-command-is-not-working possible answers here. – isydmr Nov 25 '19 at 09:32
  • it doesn't show anything to me, but when i added an output print before camera = PiCamera(), the output displayed it out. – Simon Nov 25 '19 at 09:57
  • The shell_exec works on other python script but just not on the camera trigger python code – Simon Nov 25 '19 at 10:15

0 Answers0