Re: Running CLI from a web page
| From: | Ron Rudman | Date: | Tue, 11 Nov 2003 00:16:35 +0000 |
| Subject: | Re: Running CLI from a web page | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169107@lists.php.net to get a copy of this message | ||
I have a report that I would like to run as a cron job, hence the need for a
standalone CLI version that just reads the database and has no other
context. But...I would also like to run this report on demand from within a
web application. It seemed "obvious" that all I'd have to do was execute my
command line via the system/exec/passthru type of function.
I can't see how I would use eval() here, since in the command line: "php
foo", foo is a file. A possibility here, however, is to use "include foo".
The only reason I didn't want to do that is because then the code in foo
might conflict with the context surrounding the include. I was hoping for a
simpler solution, but I might be able to isolate the include in a function.
"Chris Shiflett" <shiflett@php.net> wrote in message
news:20031111000408.65624.qmail@web14304.mail.yahoo.com...
> --- Ron Rudman <ron@helphosts.com> wrote:
> > There are already plenty of echo statements in foo! They DO show up
> > when I run php foo. It's when I try to use system("php foo") that I
> > don't get anything.
>
> I missed the original question, but why are you trying to use the PHP CLI
> from within PHP itself? Can you perhaps use eval() instead?
>
> http://www.php.net/eval
>
> Hope that helps.
>
> Chris
>
> =====
> My Blog
> http://shiflett.org/
> HTTP Developer's Handbook
> http://httphandbook.org/
> RAMP Training Courses
> http://www.nyphp.org/ramp