note 42402 added to ref.exec
| From: | dotpointer at rn2 dot php dot net | Date: | Fri, 14 May 2004 22:02:40 +0000 |
| Subject: | note 42402 added to ref.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69622@lists.php.net to get a copy of this message | ||
Win32 / PHP 4.3.6...
If you plan to start programs on the server that show message boxes (things that require OK from the
server-side), or remain (like notepad.exe), and the exec-command seems to go into an deadly loop,
then MAYBE your program has started, but you can't see it. Because the web server runs as an
system process, and it isn't allowed to interact with the desktop.
To solve a part of the problem (to see the programs you execute), in the control panel in Windows,
goto Administration->Services, right-click the server-service, goto Properties and on the second
tab (login?) and check the box about allowing the service to interact with the desktop. Click OK.
Restart the webserver, and MAKE SURE it is restarted for real (i.e. look in the task manager so the
service goes _down_), otherwise the desktop-option won't take.
Next phase would be to stop PHP from waiting for the processes to complete (this is what makes PHP
"loop"). I solved this by creating a small Delphi-application that took the path to the
file I wanted to execute and executed it by the WinExec API, which just starts the childprogram but
doesn't wait for it to complete = the program completes and the PHP.exe completes the script.
Problem solved!
Delphi-snippet:
WinExec(PChar(<CMD>),SW_SHOW); // replace <CMD> with the program path.
----
Manual Page -- http://www.php.net/manual/en/ref.exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42402
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42402&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42402&report=yes
Search -- http://master.php.net/manage/user-notes.php