470,849 Members | 1,164 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Run background process from PHP on Windows with window

Hi all!

Windows XP, Apache 2.2, PHP 5.2.5 as apache module (php5apache2_2.dll)

I need to run background process and see output but for current moment
all methods runs it as process not as application (visible in task
manager but no window attached). I tried exec, ``, popen(), with and
without start and psexec.
Is here any way to run it as separate process, without waiting (psexec
-d) and with visible window? Small example running 'cmd' in separate
window will be great.

Thanks!
Jun 27 '08 #1
20 3028
Greetings, Alexey Kulentsov.
In reply to Your message dated Sunday, June 15, 2008, 13:54:10,
Windows XP, Apache 2.2, PHP 5.2.5 as apache module (php5apache2_2.dll)
I need to run background process and see output but for current moment
all methods runs it as process not as application (visible in task
manager but no window attached). I tried exec, ``, popen(), with and
without start and psexec.
Is here any way to run it as separate process, without waiting (psexec
-d) and with visible window? Small example running 'cmd' in separate
window will be great.
I think that wintty.exe is what you're looking for.
But it was long time I have played with it.
I'm sorry if it is not what i think.
--
Sincerely Yours, AnrDaemon <an*******@freemail.ru>

Jun 27 '08 #2
Alexey Kulentsov wrote:
Hi all!

Windows XP, Apache 2.2, PHP 5.2.5 as apache module (php5apache2_2.dll)

I need to run background process and see output but for current moment
all methods runs it as process not as application (visible in task
manager but no window attached). I tried exec, ``, popen(), with and
without start and psexec.
Is here any way to run it as separate process, without waiting (psexec
-d) and with visible window? Small example running 'cmd' in separate
window will be great.

Thanks!
Go to PHP manual for exec... There is a comment there saying something
about creating a COM object.

Hendri Kurniawan
Jun 27 '08 #3
Alexey Kulentsov wrote:
Hi all!

Windows XP, Apache 2.2, PHP 5.2.5 as apache module (php5apache2_2.dll)

I need to run background process and see output but for current moment
all methods runs it as process not as application (visible in task
manager but no window attached). I tried exec, ``, popen(), with and
without start and psexec.
Is here any way to run it as separate process, without waiting (psexec
-d) and with visible window? Small example running 'cmd' in separate
window will be great.

Thanks!
You need to invoke the Windows command processor to execute an
asynchronous command. You can't do it with just PHP calls - which end
up as synchronous calls to the OS.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #4
AnrDaemon wrote:
Greetings, Alexey Kulentsov.
In reply to Your message dated Sunday, June 15, 2008, 13:54:10,
>Windows XP, Apache 2.2, PHP 5.2.5 as apache module (php5apache2_2.dll)
>I need to run background process and see output but for current moment
all methods runs it as process not as application (visible in task
manager but no window attached). I tried exec, ``, popen(), with and
without start and psexec.
Is here any way to run it as separate process, without waiting (psexec
-d) and with visible window? Small example running 'cmd' in separate
window will be great.

I think that wintty.exe is what you're looking for.
But it was long time I have played with it.
I'm sorry if it is not what i think.

You're right. It's not what you think it is. And it doesn't do what he
wants - as is normal for your "answers".

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #5
Jerry Stuckle пишет:
>
You need to invoke the Windows command processor to execute an
asynchronous command. You can't do it with just PHP calls - which end
up as synchronous calls to the OS.
Sorry I don't understand your idea. 'cmd' is exactly that I try to run
in my experiments. Can you provide example?
Jun 27 '08 #6
Hendri Kurniawan пишет:
Go to PHP manual for exec... There is a comment there saying something
about creating a COM object.
Thanks! $WshShell->Run($cmdLine, 1, false); works o.k. for me
Jun 27 '08 #7
Alexey Kulentsov пишет:
Hendri Kurniawan пишет:
>Go to PHP manual for exec... There is a comment there saying something
about creating a COM object.
Thanks! $WshShell->Run($cmdLine, 1, false); works o.k. for me
This solution works only when running script from command line. When
trying to run script from apache you will not see any window.
Jun 27 '08 #8
RakeMaster пишет:
> Thanks! $WshShell->Run($cmdLine, 1, false); works o.k. for me
This solution works only when running script from command line. When
trying to run script from apache you will not see any window.
Ooops! Yes, I din't test both variants... This is only command line
solution, yes.
Jun 27 '08 #9
AnrDaemon write:
I think that wintty.exe is what you're looking for.
But it was long time I have played with it.
I'm sorry if it is not what i think.
Great thanks! This is exactly that I need. wintty + popen (or proc_open)
+ output buffering = solution.
Works in all cases, both module and command line interfaces.

Is this possible to connect PHP stdout direct to opened by proc_open()
process? In this case I can solve problem without output buffering.
Jun 27 '08 #10
Alexey Kulentsov wrote:
Jerry Stuckle пишет:
>>
You need to invoke the Windows command processor to execute an
asynchronous command. You can't do it with just PHP calls - which end
up as synchronous calls to the OS.
Sorry I don't understand your idea. 'cmd' is exactly that I try to run
in my experiments. Can you provide example?
cmd.exe is the command processor in Windows. You can start it
asynchronously with the "start" command.

See the Windows help information.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #11
Jerry Stuckle пишет:
cmd.exe is the command processor in Windows. You can start it
asynchronously with the "start" command.

See the Windows help information.
Don't work. I tried it. See my first letter in this thread.

Jun 27 '08 #12
Alexey Kulentsov wrote:
Jerry Stuckle пишет:
>cmd.exe is the command processor in Windows. You can start it
asynchronously with the "start" command.

See the Windows help information.

Don't work. I tried it. See my first letter in this thread.

But unless it's a background process which doesn't even open stdout
(highly unusual - most open it, even if they don't use it), you have to
have a window for output.

You can start the window minimized, if you want. But if you want to be
able to start it with no window at all, you have to first ensure the
program doesn't open stdout, then use a COM object to start it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #13
Jerry Stuckle пишет:
But unless it's a background process which doesn't even open stdout
(highly unusual - most open it, even if they don't use it), you have to
have a window for output.

You can start the window minimized, if you want. But if you want to be
able to start it with no window at all, you have to first ensure the
program doesn't open stdout, then use a COM object to start it.
Ok, I understand. You didn't test it, you don't have an example and
you have nothing to write on my problem.
Jun 27 '08 #14
Alexey Kulentsov wrote:
Jerry Stuckle пишет:
>But unless it's a background process which doesn't even open stdout
(highly unusual - most open it, even if they don't use it), you have
to have a window for output.

You can start the window minimized, if you want. But if you want to
be able to start it with no window at all, you have to first ensure
the program doesn't open stdout, then use a COM object to start it.
Ok, I understand. You didn't test it, you don't have an example and
you have nothing to write on my problem.
No, I've done it before - many times. You just aren't willing to look
at the possibilities.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #15
Greetings, Alexey Kulentsov.
In reply to Your message dated Monday, June 16, 2008, 15:20:12,
>I think that wintty.exe is what you're looking for.
But it was long time I have played with it.
I'm sorry if it is not what i think.
Great thanks! This is exactly that I need. wintty + popen (or proc_open)
+ output buffering = solution.
Works in all cases, both module and command line interfaces.
Is this possible to connect PHP stdout direct to opened by proc_open()
process? In this case I can solve problem without output buffering.
Probably.... I know that it is possible to start program in windows with
reassigned STDIN/STDOUT/STDERR, but I do not know how to do that using
proc_open or other kind of process control routines in PHP.
If Jerry does not know that, I'm afraid it will be left for your research.
--
Sincerely Yours, AnrDaemon <an*******@freemail.ru>

Jun 27 '08 #16
Alexey Kulentsov wrote:
AnrDaemon write:
>I think that wintty.exe is what you're looking for.
But it was long time I have played with it.
I'm sorry if it is not what i think.

Great thanks! This is exactly that I need. wintty + popen (or proc_open)
+ output buffering = solution.
Works in all cases, both module and command line interfaces.

Is this possible to connect PHP stdout direct to opened by proc_open()
process? In this case I can solve problem without output buffering.
Yes, it is. See proc_open() in the manual for an example on how to do
it. But it won't run asynchronously with your script.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #17
Jerry Stuckle write:
>
Yes, it is. See proc_open() in the manual for an example on how to do
it. But it won't run asynchronously with your script.
???

Please don't waste my time writing me.
Jun 27 '08 #18
Alexey Kulentsov wrote:
Jerry Stuckle write:
>>
Yes, it is. See proc_open() in the manual for an example on how to do
it. But it won't run asynchronously with your script.

???

Please don't waste my time writing me.
I'm not. But if you don't want good answers, then I won't bother
wasting my time on you.

You're the one asking for help, idiot.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #19
Jerry Stuckle пишет:
I'm not. But if you don't want good answers, then I won't bother
wasting my time on you.
I have good answers - but never from you.
Let's analyze Good Answers from Jerry Stuckle (tm) in this thread:
You're right. It's not what you think it is. And it doesn't do what
he wants - as is normal for your "answers".
First of all Jerry Stuckle insult man who give me correct and best (in
fact only one for current moment) solution. Because Jerry Stuckle just
too stupid to understand my problem and this solution.
Yes, it is. See proc_open() in the manual for an example on how to
do it. But it won't run asynchronously with your script.
Second comment in this branch, again stupid. I don't need to run
WinTTY asynchronously, you stupid idiot. I run it to redirect output of
already ran asynchronously script to console window. This is exactly
what WinTTY is written for.

Let's continue with Good Answers:
You need to invoke the Windows command processor to execute an
asynchronous command. You can't do it with just PHP calls - which
end up as synchronous calls to the OS.
Just meaningless piece of cake, nothing common with my problem. I CAN
run processes asynchronously and every subscriber can understand this
from my first letter in this thread - but not Jerry Stuckle. Jerry
Stuckle just too stupid for this.

Next Good Answer from Jerry Stuckle (tm):
cmd.exe is the command processor in Windows. You can start it
asynchronously with the "start" command.

See the Windows help information.
Very, very useful answer! Every man having head with brain inside can
understand from my first letter that I know about start and psexec and
already test both cases. But not Jerry Stuckle. Jerry Stuckle prefer to
write Good Answers without reading questions.

But unless it's a background process which doesn't even open stdout
(highly unusual - most open it, even if they don't use it), you have
to have a window for output.

You can start the window minimized, if you want. But if you want to
be able to start it with no window at all, you have to first ensure
the program doesn't open stdout, then use a COM object to start it.
Next stupid comment. "But if you want to be able to start it with no
window at all" You idiot, my process already started without window
(btw, having stdout and writing to it), and this is exactly my problem.
But Jerry Stuckle too stupid to understand this.
>Ok, I understand. You didn't test it, you don't have an example and
you have nothing to write on my problem.
No, I've done it before - many times. You just aren't willing to
look at the possibilities.
If you don't understand subject - shut up. If you too tired to give
right answer - shut up. But Jerry Stuckly too stupid to understand such
complex rules. Is seems he is a bot posting common phrases to every thread.
You're the one asking for help, idiot.
Be careful, don't broke your mirror!
Bye.
Jun 27 '08 #20
Alexey Kulentsov wrote:
Jerry Stuckle пишет:
>I'm not. But if you don't want good answers, then I won't bother
wasting my time on you.
I have good answers - but never from you.
Let's analyze Good Answers from Jerry Stuckle (tm) in this thread:
>You're right. It's not what you think it is. And it doesn't do what
he wants - as is normal for your "answers".

First of all Jerry Stuckle insult man who give me correct and best (in
fact only one for current moment) solution. Because Jerry Stuckle just
too stupid to understand my problem and this solution.
>Yes, it is. See proc_open() in the manual for an example on how to
do it. But it won't run asynchronously with your script.

Second comment in this branch, again stupid. I don't need to run
WinTTY asynchronously, you stupid idiot. I run it to redirect output of
already ran asynchronously script to console window. This is exactly
what WinTTY is written for.

Let's continue with Good Answers:
>You need to invoke the Windows command processor to execute an
asynchronous command. You can't do it with just PHP calls - which
end up as synchronous calls to the OS.

Just meaningless piece of cake, nothing common with my problem. I CAN
run processes asynchronously and every subscriber can understand this
from my first letter in this thread - but not Jerry Stuckle. Jerry
Stuckle just too stupid for this.

Next Good Answer from Jerry Stuckle (tm):
>cmd.exe is the command processor in Windows. You can start it
asynchronously with the "start" command.

See the Windows help information.

Very, very useful answer! Every man having head with brain inside can
understand from my first letter that I know about start and psexec and
already test both cases. But not Jerry Stuckle. Jerry Stuckle prefer to
write Good Answers without reading questions.

>But unless it's a background process which doesn't even open stdout
(highly unusual - most open it, even if they don't use it), you have
to have a window for output.

You can start the window minimized, if you want. But if you want to
be able to start it with no window at all, you have to first ensure
the program doesn't open stdout, then use a COM object to start it.

Next stupid comment. "But if you want to be able to start it with no
window at all" You idiot, my process already started without window
(btw, having stdout and writing to it), and this is exactly my problem.
But Jerry Stuckle too stupid to understand this.
>>Ok, I understand. You didn't test it, you don't have an example and
you have nothing to write on my problem.
No, I've done it before - many times. You just aren't willing to
look at the possibilities.

If you don't understand subject - shut up. If you too tired to give
right answer - shut up. But Jerry Stuckly too stupid to understand such
complex rules. Is seems he is a bot posting common phrases to every thread.
>You're the one asking for help, idiot.

Be careful, don't broke your mirror!
Bye.
What an idiot. The biggest one I've seen here in c.l.p for several months.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #21

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Harlin Seritt | last post: by
4 posts views Thread by Mrinal Kamboj | last post: by
11 posts views Thread by Steve Kirkendall | last post: by
4 posts views Thread by g.ankush1 | last post: by
4 posts views Thread by Jake Yu | last post: by
4 posts views Thread by Podi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.