Therysin
Posts: 6
Joined: Mon Nov 06, 2017 6:54 pm

PHP and OMXplayer help

Mon Nov 06, 2017 7:02 pm

Good day all, hate to have my first post asking for help but here I am... I'm working on a school project where I need to make a web GUI for omxplayer (I know there are already some but it's just what I have to do). So what I thought was I'd get a webserver running, which I did using nginx , and I also installed php7. I went about doing this by using shell_exec(), which works perfectly for commands that doesn't output to the screen, but anything like omxplayer, which I need to launch on the host, simply doesn't work. Echoing the output from the shell_exec() gives 'have a nice day' like if it was working, but it doesn't play anything. I'm rather new to the raspi and linux in general so I apologize in advance for any misconceptions.

Just as a side note, other GUI applications like pcmanfm wouldn't launch either, so I'm assuming it's something with the desktop display? (I also tried booting in command line mode but omxplayer didn't play anything still). I really don't know where to go from here, so any help is greatly appreciated. Thank you.

jehutting
Posts: 143
Joined: Sun Feb 15, 2015 8:37 am
Location: The Netherlands

Re: PHP and OMXplayer help

Wed Nov 08, 2017 2:46 am

Just to be sure :) , you have a monitor connected to your raspberry pi HDMI port?
If so, what is the command that you run on the (raspberry pi) command line, and what does OMXPlayer output?

Therysin
Posts: 6
Joined: Mon Nov 06, 2017 6:54 pm

Re: PHP and OMXplayer help

Fri Nov 10, 2017 6:57 am

jehutting wrote:
Wed Nov 08, 2017 2:46 am
Just to be sure :) , you have a monitor connected to your raspberry pi HDMI port?
If so, what is the command that you run on the (raspberry pi) command line, and what does OMXPlayer output?
I managed to get it working by removing nginx and installing apache, then setting the env variable user to pi. I know that's insecure but I don't need the security in this case. Now I ran into another problem; I'm using shell_execute() and dbuscontrol.sh to make the webgui controls now, and none of the commands work, yet they work fine in terminal. No output either. Other commands like 'whoami' works (output is pi as expected).
My apologies for the late reply, I got no notification that my thread was approved :(. Thanks for the reply.

Therysin
Posts: 6
Joined: Mon Nov 06, 2017 6:54 pm

Re: PHP and OMXplayer help

Fri Nov 10, 2017 8:21 am

Got this fixed as well. Almost pulled my hair out at this. When running the script(dbuscontrol.sh) with no parameters, there was no output on the browser(for the echo shell_exec(sh /dbuscontrol.sh). Somehow redirecting STDERR to STDOUT solved this (appending 2>&1 to end of command). Now, all dbus commands work as expected so no need to pipe commands to terminal which I thought I would have to do. Can anyone explain why this even works? Thank you.

Return to “Troubleshooting”