-1

Referring to this Question and this.

How to open any GUI application from a browser. It is working as expected if executed from a terminal. I basically need to open the desktop applications from a webpage. Do I need to provide any additional permissions?

4
  • 1
    What you are requesting is, essentially, how to hack into the computers of people who visit a site you control and run arbitrary code. In a perfect world this would be completely impossible. Aug 8, 2019 at 3:49
  • I need to open GUI Application at server-side not client-side. I need to create a GUI to invoke other desktop applications. I'm searching for the possibilities with Web.
    – Pramod
    Aug 8, 2019 at 12:47
  • Then I stand corrected. The part that confused me was the bit about launching applications from a browser... which is client side. The issue is probably permissions. Most http daemons are setup to run under a very limited user account specifically dedicated to that use. The php code would be run as that user. The active display manager, however, would be owned by your own user. Unfortunately, I do not know exactly how to solve this. Aug 8, 2019 at 14:30
  • Thank you @Cliff Armstrong. I will try in this direction.
    – Pramod
    Aug 8, 2019 at 14:48

1 Answer 1

0

You can use exec():

https://www.php.net/manual/en/function.exec.php

This is designed to allow you to execute code when the PHP is evaluated on the server. If you want the web browser to execute the application via, e.g., button, you'll have to use Javascript AJAX to call a server side PHP script with the exec() in it.

2
  • I tried with both exec() and shell_exec(), they cannot invoke GUI applications like gnome-terminal. It has to do something with the X server.
    – Pramod
    Aug 9, 2019 at 2:45
  • Yeah, the GUI needs an X session. You'd need a listener that runs with cron (or something) that waits for communication from the PHP script and then performs the action. Aug 9, 2019 at 14:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .