3

I want to run a PHP Script with an Infinite Loop on my Raspberry Pi to fade LED-Strips.

So the Script should contain an infinite loop and should be closed from outside of the loop.

For Example: Script gets a POST-Request from another PHP-script by ajax and should run the infinite loop for fading. If I select just a color for the LEDs the script gets another ajax-request and the infinite loop stops.

Do I need something similar to python subprocess and is something like this even available in PHP?

Thanks guys.

flyb29
  • 31
  • 3
  • More information is needed here. Are the requests being sent through a web server? Is the script that runs the infinite loop being activated by the web server or does it run via another mechanism, e.g. cron? – kmoser Nov 06 '17 at 04:24
  • It's a site that is accessible with my phone (just apache). If i click on the fade-button jquery sends an ajax request to another PHP-file (same directory) and there an infinite loop starts the fading. Then I want to stop fading by clicking on another button and an ajax request should stop the infinite loop. – flyb29 Nov 06 '17 at 04:29

0 Answers0