Check the archives on this...

But you need the executable php

And on top of the file:


#!/usr/bin/php -q

...stuff here

Then chmod the script to be executable and you can run from commandline.
For cron jobs just put it in the cron file and put the path to the file...

.: B i g D o g :.

----- Original Message -----
From: "Zach Curtis" <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 4:17 PM
Subject: [PHP] Running a PHP Script from UNIX Command Line?

> UNIX gurus:
> How can I get a PHP script to run or execute from a UNIX command line and
> echo the stdout back to the terminal window?
> For example,
> > execute/run??? file.php
> What I really want to do is create a cron job (which I do know how to
> create) for the script. The script doesn't really echo any results back,
> logs its results. The script it too time consuming to be run by having
> someone running the script through a web browser and waiting for it to
> complete.
> Thank you very much.
> _________________
> Zach Curtis
> Programmer Analyst
> _________________
> Confidentiality Statement:
> This e-mail message and any attachment(s) are confidential and may contain
> proprietary information that may not be disclosed without express
> permission.  If you have received this message in error or are not the
> intended recipient, please immediately notify the sender by replying to
> message and then please delete this message and any attachment(s).  Any
> dissemination, distribution, or reproduction by unintended recipients is
> authorized. Thank you.
> --
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to