PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Run background process from PHP on Windows with window
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Run background process from PHP on Windows with window

Réponse
 
LinkBack Outils de la discussion
Vieux 15/06/2008, 10h54   #1
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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!
  Réponse avec citation
Vieux 16/06/2008, 01h10   #2
AnrDaemon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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 <anrdaemon@freemail.ru>

  Réponse avec citation
Vieux 16/06/2008, 02h07   #3
Hendri Kurniawan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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
  Réponse avec citation
Vieux 16/06/2008, 02h48   #4
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 16/06/2008, 02h49   #5
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 16/06/2008, 11h59   #6
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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?
  Réponse avec citation
Vieux 16/06/2008, 12h01   #7
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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
  Réponse avec citation
Vieux 16/06/2008, 12h12   #8
RakeMaster
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
  Réponse avec citation
Vieux 16/06/2008, 12h15   #9
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
  Réponse avec citation
Vieux 16/06/2008, 12h20   #10
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
  Réponse avec citation
Vieux 16/06/2008, 13h08   #11
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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 information.

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

  Réponse avec citation
Vieux 16/06/2008, 13h13   #12
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

Jerry Stuckle пишет:

> cmd.exe is the command processor in Windows. You can start it
> asynchronously with the "start" command.
>
> See the Windows information.


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

  Réponse avec citation
Vieux 16/06/2008, 13h32   #13
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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 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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 16/06/2008, 14h10   #14
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
  Réponse avec citation
Vieux 16/06/2008, 16h23   #15
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 16/06/2008, 20h30   #16
AnrDaemon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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 <anrdaemon@freemail.ru>

  Réponse avec citation
Vieux 16/06/2008, 22h31   #17
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 16/06/2008, 23h43   #18
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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.
  Réponse avec citation
Vieux 17/06/2008, 00h15   #19
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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 , idiot.

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

  Réponse avec citation
Vieux 17/06/2008, 09h43   #20
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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 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 , idiot.


Be careful, don't broke your mirror!


Bye.
  Réponse avec citation
Vieux 17/06/2008, 11h25   #21
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run background process from PHP on Windows with window

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 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 , 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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h17.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,27076 seconds with 29 queries