On Wed, 14 Jul 2004 15:15:04 GMT, "deko" <no****@hotmail.com> wrote:
If you are calling the php script from the command line without shebang
you will need to execute it by typing
$ php script.php
With a shebang it can be called as follows
$ script.php
So it is only when I call the script from the command line that I need the
shebang? Then no modification is needed to run my script using cron...
that's what I thought, but wasn't sure.... thanks...
no.
running a script from a cron job is the same as running it from the
command line (more or less, see note [1] below).
from the command line, you can invoke a php script in two ways:
$ php [-q] /path/to/script.php
or
$ /path/to/script.php
in the second method, the script _must_ have a shebang specifying the
location of your php binary, eg. #!/usr/local/bin/php
entries in your crontab are the same, eg:
45 3 * * * /usr/local/bin/php -q /path/to/script.php
or
45 3 * * * /path/to/script.php
in the second method the script must also have a shebang.
[1] note that your cron job will almost certainly not know about any
PATH information you may have set up in your shell, so you must always
give the full path to the php binary if you are invoking your script
using the first method in the case above.