I jsut found a solution working ;))
Thanks to your reply which helped me much.

Here are two example files to see how it works :
<?
        
putenv("LANG=test");
$command=`php -q test.php`;
echo $command;

?>

which calls

<? 

        $lang=`echo %LANG%`;
        echo $lang;
?>

It seems to work under Windows.
Regards,

Leonard Schneider


--- Simon Garner <[EMAIL PROTECTED]> wrote:
> From: "Leonard Schneider" <[EMAIL PROTECTED]>
> 
> > Thanks for your reply
> >
> > Maybe it is dut to that I use a Windows98 OS, but environment
> variables
> > functions don't seem to work. Moreover, I couldn't make the exec()
> and
> > system() commands properly to run php from dos shell. Is it a
> security
> > ?
> > Anyway as my first problem is that
> > is there any trick to pass variables to php script when executing
> from
> > command line ?
> > Is there anyone who would have any idea or trick to help this ?
> >
> > Leonard Schneider
> >
> 
> 
> Ah, I'm afraid I have no experience with PHP under Windows so I can't
> really
> help you there sorry.
> 
> I'm not aware of any other way than environment variables to pass
> data to
> PHP scripts executed from the command line so you may be out of luck
> if they
> don't work under Windows. Perhaps someone else on this list will be
> able to
> help...
> 
> 
> Cheers
> 
> Simon Garner
> 
> 
> 
> > --- Simon Garner <[EMAIL PROTECTED]> wrote:
> > > From: "Leonard Schneider" <[EMAIL PROTECTED]>
> > >
> > > > I use PHP as script to generate HTML pages using the command
> > > > php -q script.php > file.html
> > > >
> > > > I would like to pass some variables to the PHP script so that
> it
> > > > generates a different HTML file.
> > > > I tried the -d option but it seems it doesn't work.
> > > > Is there any means of doing this ?
> > > >
> > > >
> > > > Leonard Schneider
> > > >
> > >
> > >
> > > Easiest way is using environment variables.
> > >
> > >
> > > <?php
> > >     system("SOME_VAR=blah; php -q script.php > file.html");
> > > ?>
> > >
> > >
> > > Then in script.php you can do:
> > >
> > > <?php
> > >     $some_var = getenv("SOME_VAR");
> > > ?>
> > >
> > >
> > > Hope this helps,
> > >
> > > Simon Garner
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Auctions - Buy the things you want at great prices!
> http://auctions.yahoo.com/
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to