Many people forget that PHP is also a shell scripting language (CLI) and
you can often make the script directly executable (chmod 755 or 700) and
put in a shebang (#!) to the PHP CLI interpreter.
Code:
#!/usr/bin/php
<?php
// whatever code
?>
More information about PHP command line capabilities is at:
http://www.php.net/manual/en/features.commandline.php
If you are using PHP's powerful shell scripting capability then you can
add the PHP script directly to any cronjob just by specifying the PHP
script file name alone as the script you want to run along with
whatever command line parameters you want to pass to it.
In contrast ...
For a web based PHP script that you want to run by cronjob, you will
need to prefix the script filename in the cronjob by "php " which basically
will run it somewhat similiar to the CLI spoken of earlier.
(OR)
To have a cronjob call the script directly from the web site as though
it were being called from a web site visitor, you would need to instead
make the script name a full web address and prefix it with "lynx "
in the cronjob.
As you can see, lots of ways to call PHP scripts from cronjobs. I personally
prefer to shebang the scripts and run them as CLI shell scripts directly
instead of calling them from the web server. This keeps things more
internal, uses less resources, and doesn't tie up any network sockets
otherwise routing your script through your web server.