You are here: Re: Launching a program with exec & pstools/psexec.exe « PHP Programming Language « IT news, forums, messages
Re: Launching a program with exec & pstools/psexec.exe

Posted by Schraalhans Keukenmeester on 04/10/07 07:46

vol30w60 wrote:
> Hi folks,
>
> I am trying to launch a program with PHP code. I am running Apache on
> Windows XP SP2.
>
> I am using the method noted here:
> http://us2.php.net/manual/en/function.exec.php#59428
>
> To simplify things, I am trying to launch notepad with the following
> line of code:
>
> <?php
>
> exec('C:\PsTools\psexec.exe -d -s notepad.exe 2>&1', $output);
>
> ?>
>
> I can see psexec running in the Task Manager, but it does not launch
> notepad and does not return control to PHP. If I manually quit psexec
> from the Task Manager, PHP will resume executing the script.
>
> Running this from the command line works fine:
> C:\PsTools\psexec.exe -d -s notepad.exe 2>&1
>
> If I force quit psexec and do a var_dump() on $output, I see:
>
> array(5) { [0]=> string(0) "" [1]=> string(41) "PsExec v1.82 - Execute
> processes remotely" [2]=> string(40) "Copyright (C) 2001-2007 Mark
> Russinovich" [3]=> string(35) "Sysinternals - www.sysinternals.com"
> [4]=> string(0) "" }
>
> Note that there is no error message, but the expected output should have
> a sixth line something like this:
> notepad.exe started on HAL with process ID 4668.
>
> Any ideas on how I can get this to work?
>
>
Which user shows in TaskManager running psexec (and Notepad?) when run
from PHP vs. from commandline? I don't know the program psexec btw. Is
that a must-use for exec-ing stuff in windows from apache?

Sh.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация