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 > Single cmd/bash session for all exec() calls - is this possible?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Single cmd/bash session for all exec() calls - is this possible?

Réponse
 
LinkBack Outils de la discussion
Vieux 12/09/2007, 11h50   #1
melmack3@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Single cmd/bash session for all exec() calls - is this possible?

Hello

My PHP script executes many bash/cmd commands.
Functions like "exec()" or "system()" cause that new bash/cmd session
is started,
the command is executed and the session is closed. Unfortunately
it is very slow process so I would like to increase performance and
open one bash/cmd session on the begin of my script and execute
the commands such as in normal system opened bash/cmd window and close
it
at the end of my PHP script.
Does anybody know whether and (if yes) how can I do that?

PS. I need the retrieve informations from previous command before
executing next command because next command is strongly dependent on
the
results from previous command.

Best regards
Melmack

  Réponse avec citation
Vieux 12/09/2007, 13h36   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Single cmd/bash session for all exec() calls - is this possible?

melmack3@gmail.com wrote:
> Hello
>
> My PHP script executes many bash/cmd commands.
> Functions like "exec()" or "system()" cause that new bash/cmd session
> is started,
> the command is executed and the session is closed. Unfortunately
> it is very slow process so I would like to increase performance and
> open one bash/cmd session on the begin of my script and execute
> the commands such as in normal system opened bash/cmd window and close
> it
> at the end of my PHP script.
> Does anybody know whether and (if yes) how can I do that?
>
> PS. I need the retrieve informations from previous command before
> executing next command because next command is strongly dependent on
> the
> results from previous command.
>
> Best regards
> Melmack
>


Melmack,

You might be able to open the command shell with proc_open() and
communicate through the pipes.

I've never tried it in PHP, but done similar in C before.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
Vieux 12/09/2007, 17h17   #3
c.g.dangelo@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Single cmd/bash session for all exec() calls - is this possible?

On Sep 12, 6:50 am, melma...@gmail.com wrote:
> Hello
>
> My PHP script executes many bash/cmd commands.
> Functions like "exec()" or "system()" cause that new bash/cmd session
> is started,
> the command is executed and the session is closed. Unfortunately
> it is very slow process so I would like to increase performance and
> open one bash/cmd session on the begin of my script and execute
> the commands such as in normal system opened bash/cmd window and close
> it
> at the end of my PHP script.
> Does anybody know whether and (if yes) how can I do that?
>
> PS. I need the retrieve informations from previous command before
> executing next command because next command is strongly dependent on
> the
> results from previous command.
>
> Best regards
> Melmack


I would write a bash script and just execute that from within PHP. If
you're using so many commands that performance is becoming an issue,
I'd recommend that you try that. Bash scripting is terribly easy to
learn if you don't already know how. Even if you did find an
alternative in PHP, I don't think it would be as efficient as
executing a single script.


-c

  Réponse avec citation
Vieux 12/09/2007, 18h19   #4
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Single cmd/bash session for all exec() calls - is this possible?

c.g.dangelo@gmail.com wrote:
> On Sep 12, 6:50 am, melma...@gmail.com wrote:
>> Hello
>>
>> My PHP script executes many bash/cmd commands.
>> Functions like "exec()" or "system()" cause that new bash/cmd session
>> is started,
>> the command is executed and the session is closed. Unfortunately
>> it is very slow process so I would like to increase performance and
>> open one bash/cmd session on the begin of my script and execute
>> the commands such as in normal system opened bash/cmd window and close
>> it
>> at the end of my PHP script.
>> Does anybody know whether and (if yes) how can I do that?
>>
>> PS. I need the retrieve informations from previous command before
>> executing next command because next command is strongly dependent on
>> the
>> results from previous command.
>>
>> Best regards
>> Melmack

>
> I would write a bash script and just execute that from within PHP. If
> you're using so many commands that performance is becoming an issue,
> I'd recommend that you try that. Bash scripting is terribly easy to
> learn if you don't already know how. Even if you did find an
> alternative in PHP, I don't think it would be as efficient as
> executing a single script.
>
>
> -c
>


You missed one salient point in his post:

"PS. I need the retrieve informations from previous command before
executing next command because next command is strongly dependent on the
results from previous command."

Can't do it with a bash script unless you're willing to do all the work
in the script.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
Vieux 12/09/2007, 19h22   #5
c.g.dangelo@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Single cmd/bash session for all exec() calls - is this possible?

On Sep 12, 1:19 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> c.g.dang...@gmail.com wrote:
> > On Sep 12, 6:50 am, melma...@gmail.com wrote:
> >> Hello

>
> >> My PHP script executes many bash/cmd commands.
> >> Functions like "exec()" or "system()" cause that new bash/cmd session
> >> is started,
> >> the command is executed and the session is closed. Unfortunately
> >> it is very slow process so I would like to increase performance and
> >> open one bash/cmd session on the begin of my script and execute
> >> the commands such as in normal system opened bash/cmd window and close
> >> it
> >> at the end of my PHP script.
> >> Does anybody know whether and (if yes) how can I do that?

>
> >> PS. I need the retrieve informations from previous command before
> >> executing next command because next command is strongly dependent on
> >> the
> >> results from previous command.

>
> >> Best regards
> >> Melmack

>
> > I would write a bash script and just execute that from within PHP. If
> > you're using so many commands that performance is becoming an issue,
> > I'd recommend that you try that. Bash scripting is terribly easy to
> > learn if you don't already know how. Even if you did find an
> > alternative in PHP, I don't think it would be as efficient as
> > executing a single script.

>
> > -c

>
> You missed one salient point in his post:
>
> "PS. I need the retrieve informations from previous command before
> executing next command because next command is strongly dependent on the
> results from previous command."
>
> Can't do it with a bash script unless you're willing to do all the work
> in the script.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================


Perhaps you've misunderstood me: doing all the work in the bash script
was what I had suggested, in fact.

  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 12h35.


Édité par : vBulletin® version 3.7.2
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
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15910 seconds with 13 queries