Re: Browser hangs with exec, HELP!!!!!
| From: | Juan Claudio Santana Saldaña | Date: | Mon, 13 Nov 2000 16:18:13 +0000 |
| Subject: | Re: Browser hangs with exec, HELP!!!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24970@lists.php.net to get a copy of this message | ||
The process can run and be killed as nobody user. This is very annoying...
Most of php is just great but this part sucks...
Chris Carbaugh wrote:
> The script should not wait for the commad to finish it you use command >
> log 2>&1 &. This way, your redirecting both stderr and stdout to file,
> and kicking the process to the background.
>
> One other thing to check is permissions. Since your shell script is
> being invoked by your webserver, it will run as the use the web server
> runs as. Ussually nobody:nogroup on apache.
>
> I bet user nobody can't kill the processes your your trying to kill do
> to lack of permissions. By killall failing, it just might make your
> shell script go defunct. Maybe but a 'su TheRightUser' in shell
> script?
>
> I quick and dirty way to see if it is permissions is to make your web
> server run as root, WHICH YOU SHOULD NEVER DO, except for a quick test
> on a controlled machine. And then you still shouldn't do it.....
>
> Chris
>
> On Sat, 11 Nov 2000, Steve Lawson wrote:
> > Date: Sat, 11 Nov 2000 19:17:58 -0700
> > To: <claudio@santana.net>
> > From: "Steve Lawson" <fookilla@home.com>
> > Subject: Re: [PHP] Browser hangs with exec, HELP!!!!!
> >
> > Juan,
> > The exec command waits for whatever you are executing to stop
> > before it
> > continues down the page.
> >
> > You probably want to avoid using a script which calls itself if you
> > can.
> >
> > SL.
> >
> >
> > ----- Original Message -----
> > From: "Juan Claudio Santana Saldaña" <claudio@santana.net>
> > To: <php-general@lists.php.net>
> > Sent: Saturday, November 11, 2000 12:02 PM
> > Subject: [PHP] Browser hangs with exec, HELP!!!!!
> >
> >
> > > Hello guys,
> > >
> > > I hope you can help me with this one. I have this small php
> > script
> > > where I make this call:
> > >
> > > exec( EscapeShellCmd( "/home/dbuser/myprocess.sh & >
> > > /home/dbuser/logfile.log 2>&1" ) );
> > >
> > > the script is something like this:
> > >
> > > #!/bin/bash
> > >
> > > killall myprocessa
> > > killall myprocessb
> > >
> > > /home/dbuser/restartoldprocesses.sh &
> > > exit 0
> > >
> > > The script executes with no problems but the browser hangs and
> > never
> > > returns!!! then I go the the shell and run ps -ax and get this:
> > >
> > > <some_processid> ? Z 0:00 [myprocess.sh <defunct>]
> > >
> > > I'm running php 4.02 with apache 1.3.14 with gp, mysql, psql, ttf,
> > jpeg
> > > and gif supports. I've read every single line of the php manual
> > pages
> > > about executing shell processes and it doesn't make any sense what
> > is
> > > happening to my script. Please HELP!!!!! HELP!!!!! HELP!!!!!
> > >
> > >
> > > Claudio Santana.
> > >
> > >
> >
> >
> >
> ----------------------------------------------------------------------------
> > ----
> >
> >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> >
> --
> "When we lose the right to be different, we lose the privilege to be
> free." - Charles Evans Hughes