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;
?>
4
  • Is there some form of error message to go along with it or does it simply not do anything? Commented Nov 25, 2019 at 9:31
  • stackoverflow.com/questions/20124327/… possible answers here. Commented Nov 25, 2019 at 9:32
  • it doesn't show anything to me, but when i added an output print before camera = PiCamera(), the output displayed it out. Commented Nov 25, 2019 at 9:57
  • The shell_exec works on other python script but just not on the camera trigger python code Commented Nov 25, 2019 at 10:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.