Re: PHP and Cron
| From: | Max Derkachev | Date: | Thu, 14 Sep 2000 16:55:28 +0000 |
| Subject: | Re: PHP and Cron | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16811@lists.php.net to get a copy of this message | ||
Shouldn't you try to write
#!/usr/local/bin/php -q
at the VERY FIRST line in your php script, then chmod it u+x and execute it?
It's so simple.
Those #!.. things aren't perlish or something. It's your system judges what
program this script to execute with.
Well, if it's not acceptable, you can even write a line in crontab:
00 01 **** /usr/local/bin/php -q script.php
If you do so, there is no need in placing #!/usr/local/bin/php -q instruction
in your script.
The script does not even need to have executable bit.
Example:
script.php:
.........
#!/usr/local/bin/php -q
<?php
echo "it works\n";
?>
.....
chmod u+x script.php
./script.php
it works
> Adam Charnock wrote:
> >
> > Hi all. I have written a PHP script that needs to be run as a cron job.
> > However, since it does not have a line such as this I am told it will not
> > work:
> > #!/usr/bin/perl
> >
> > Has anyone else managed a work around for this problem or is there a good
> > solution to it?
> >
> > Thanks
> > Adam Charnock
--
Best regards,
Max A. Derkachev mailto:kot@books.ru
Symbol-Plus Publishing Ltd.
phone: +7 (812) 265-0054, 265-1228, phone/fax: 567-8775
http://www.Books.Ru -- All Books of Russia