Re: question about executing a bash shell script...
| From: | Kelly Meeks | Date: | Fri, 16 Aug 2002 20:47:53 +0000 |
| Subject: | Re: question about executing a bash shell script... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113012@lists.php.net to get a copy of this message | ||
Hi Robert,
Thanks so much for the prompt reply.
Actually, I'm not trying to execute a php script, I'm trying to execute a
shell (bash) script.
This works at the command line:
bash makethesite.sh param1 param2 param3
This doesn't work via php
$bashresult=shell_exec('bash makethesite.sh param1 param2 param3');
echo $bashresult;
Doesn't execute the script, nothing in $bashresult
Kelly
----- Original Message -----
From: "Robert Cummings" <robert.cummings@webmotion.com>
To: "Kelly Meeks" <info@rightangleinc.com>
Cc: <php-general@lists.php.net>
Sent: Friday, August 16, 2002 4:44 PM
Subject: Re: [PHP] question about executing a bash shell script...
> Kelly Meeks wrote:
> >
> > Hi folks,
> >
> > I'm learning shell scripting via linux, and have written a script that
creates the core files necessary for a users website from a master set of
files.
> >
> > Works from the shell just fine (bash makethesite.sh username
pathtoputfiles pathtogetfiles)
> >
> > Trying to execute this via php, and it literally does nothing.
> >
> > If I try something like:
> > $bashoutput=shell_exec('bash makethesite.sh username pathtoputfiles
pathtogetfiles');
> > echo $bashoutput;
> >
> > I get nothing output, and the script doesn't execute.
>
>
> I'm asuming you are executing something like the following:
>
> php myPhpScript.php
>
> The following will probably give you the desired results...
>
> php -qC myPhpScript.php
>
> This prevents PHP from switching out of the current directory.
>
> HTH,
> Rob.
> --
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer |
> :----------------------------------------------:
> | Mail : mailto:robert.cummings@webmotion.com |
> | Phone : (613) 731-4046 x.109 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com |
> | Fax : (613) 260-9545 |
> `----------------------------------------------'
>