hakermania Posted June 7, 2011 Share Posted June 7, 2011 I have an apache server in my Ubuntu laptop and I use PHP. The server exists to make the communication with my friends possible even if im not in any chatroom or something like this. So, I made a simple php file with enables the outside world to send me a message, but when zeniy, the program that will create the GUI message is ready to take place, I get error the *Display not Found* and such Even if I execute the command like DIPLAY=:0 command_Here i get the same So, is there any way to make exec() run a GUI ? Quote Link to comment Share on other sites More sharing options...
xyph Posted June 7, 2011 Share Posted June 7, 2011 If you try to launch GUI apps from a service in Vista, you'll have lots of trouble. As a security feature, Vista mediates the interaction of services with the desktop using 'Interactive Services Detection'. That means, if you are running PHP as a module of an Apache service, you won't be able to launch GUI apps using any method. This kind of thing just won't work: $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("notepad.exe", 7, false); So, if you want to use Apache/PHP as a proxy for launching GUI apps, you'll need to run Apache as a console application. First, if Apache is already installed as a service, you'll need to set it's startup type to "manual" using the services snap-in. (%SystemRoot%\system32\services.msc) Search for Services in the start menu search box. Then add a shortcut to C:\apache\bin\httpd.exe (or wherever Apache is installed) to your Startup folder, and set that shortcut to start minimized. You can use an app like TrayIt! to force Apache down into the system tray. Then use any of the methods outlined on the PHP website and you will be able to open a Windows application from PHP and see it's GUI. http://php.net/manual/en/book.exec.php Quote Link to comment Share on other sites More sharing options...
hakermania Posted June 7, 2011 Author Share Posted June 7, 2011 Yes, I've read this dozens of times and I hadn't come up with a solution Quote Link to comment Share on other sites More sharing options...
hakermania Posted June 9, 2011 Author Share Posted June 9, 2011 bump Quote Link to comment Share on other sites More sharing options...
chintansshah Posted June 9, 2011 Share Posted June 9, 2011 Hi, Can you please explain in detail. Quote Link to comment Share on other sites More sharing options...
hakermania Posted June 10, 2011 Author Share Posted June 10, 2011 I am running: Linux MaD-pc 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux And I am using this PHP: Build Date May 2 2011 23:04:25 Server API Apache 2.0 Handler Apache Version Apache/2.2.17 (Ubuntu) I don't know if you need more details! Well, the problem is that when I am trying to run a GUI program (a non-terminal-program) I get error messages: cannot connect to the DISPLAY cannot connect to :0.0 That's the problem. Any other info needed? Quote Link to comment Share on other sites More sharing options...
hakermania Posted June 16, 2011 Author Share Posted June 16, 2011 BUMP common! Quote Link to comment Share on other sites More sharing options...
hakermania Posted July 9, 2011 Author Share Posted July 9, 2011 bump ubmp mpbu pmub Quote Link to comment Share on other sites More sharing options...
hakermania Posted July 18, 2011 Author Share Posted July 18, 2011 bump Quote Link to comment Share on other sites More sharing options...
trq Posted July 18, 2011 Share Posted July 18, 2011 Your Apache user (www on Ubuntu) will need to be in the groups with sufficient permissions to run desktop applications. I'm not exactly sure what groups this would entail on Ubuntu but on Gentoo, video should suffice. Even then, I'm not sure how (or if) you could get permissions to execute something on another users desktop. You would likely need to have the process su to your own users first. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.