简体   繁体   English

Lightshowpi在浏览器上抛出错误:Raspberry Pi 3

[英]Lightshowpi throwing error on browser : Raspberry Pi 3

I have successfully install Lightshow pi on Raspberry pi 3 and through ssh using below command I can run the music successfully : 我已成功在Raspberry pi 3上安装Lightshow pi,并通过ssh使用以下命令,我可以成功运行音乐:

sudo python /home/pi/lightshowpi/py/synchronized_lights.py -file=/home/pi/lightshowpi/music/sample/closer.mp3

But I want the music should start from browser for that I have used php to execute the SSH command like below : 但我希望音乐应该从浏览器开始,因为我已经使用php执行SSH命令,如下所示:

exec("sudo python /home/pi/lightshowpi/py/synchronized_lights.py --file=/home/pi/lightshowpi/music/sample/closer.mp3");

I am getting below error : 我收到以下错误:

Need to setup SYNCHRONIZED_LIGHTS_HOME environment variable, see readme.

What I have missed during installation or any changes I have to make in the code to run it from browser? 我在安装过程中遗漏了什么或者我必须在代码中进行任何更改以从浏览器运行它?

I have managed to start the music using below code : 我已设法使用以下代码启动音乐:

<?php

$x = "sudo python ";
$y = "/home/pi/lightshowpi_new/py/synchronized_lights.py --file=";
$z = $x.$lightshowpihome.$y.'/home/pi/lightshowpi_new/music/sample/closer.mp3';

putenv("SYNCHRONIZED_LIGHTS_HOME=/home/pi/lightshowpi_new");

echo $z;
exec($z);
?>

putenv was the function to set the environment variable in PHP for lightshowpi putenv是在PHP中为lightshowpi设置环境变量的函数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM