0

Using a Raspberry Pi, I have created a web-server.

End goal: The web-page prompts the user for the URL, the URL is sent from the client to the server, and the URL is opened in the Raspberry Pi's browser: Epiphany.

As of now, I have a basic form for the URL on the web-page, and once the submit button is pressed, the server uses PHP to read the input.

How can I open a webpage on the server, Raspberry Pi, with that URL?

Update: Forgot to mention, the Raspberry Pi is running Raspbian.

Ethernetz
  • 906
  • 3
  • 16
  • 33
  • If Epiphany works anything like a regular browser, can't you just write `epiphany [url]` in terminal? Just like I can write `user@box:~$ firefox www.stackexchange.com` to open firefox and fetch SE on my computer. Then, call that command via php's exec/shell_exec or similar. I assume you got a monitor connected and aren't running a headless Pi server. – jDo Apr 04 '16 at 19:41
  • We are in the process of using php's shell_exec command, but now we are faced with an error, "Failed to parse arguments: Cannot open display" – Ethernetz Apr 04 '16 at 19:54

1 Answers1

0

This sounds like an X11 display problem.

Using shell_exec, have your web server show the value of the DISPLAY environment variable. If it's not set, you'll need to set it (probably to :1.0).

You may also need to use xhost + to grant permission to the root user (assuming the web server is running as root).

Doug Harris
  • 3,169
  • 5
  • 29
  • 31