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.
Système d'exécution de programme
- Introduction
- Installation/Configuration
- Constantes pré-définies
- Fonctions sur l'exécution de programmes externes
- escapeshellarg — Protège une chaîne de caractères pour utilisation en ligne de commande
- escapeshellcmd — Protège les caractères spéciaux du Shell
- exec — Exécute un programme externe
- passthru — Exécute un programme externe et affiche le résultat brut
- proc_close — Ferme un processus ouvert par proc_open
- proc_get_status — Lit les informations concernant un processus ouvert par proc_open
- proc_nice — Change la priorité d'exécution du processus courant
- proc_open — Exécute une commande et ouvre les pointeurs de fichiers pour les entrées / sorties
- proc_terminate — Termine un processus ouvert par proc_open
- shell_exec — Exécute une commande via le Shell et retourne le résultat sous forme de chaîne
- system — Exécute un programme externe et affiche le résultat
Exécution de programme
Joe Engel
31-Dec-2008 11:46
31-Dec-2008 11:46
