RE: [PHP] PHP and Cron
| From: | Marc Burgauer | Date: | Thu, 14 Sep 2000 15:11:08 +0000 |
| Subject: | RE: [PHP] PHP and Cron | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16791@lists.php.net to get a copy of this message | ||
Instead of the "perl" line, you will have to use a PHP-line:
A) You need to have compiled PHP as a standalone executeable, which is the
same as to compile it as CGI.
Then you should copy the executeable PHP into /usr/bin and type
chmod +x php
B) When writing a script, the shebang line has to look like this:
#!/usr/bin/php
The PHP code follows this line: (with line numbers)
1#!/usr/bin/php
2<?php
3 echo "Hello World!\n";
4?>
5
C) Once the script is saved you have to
chmod +x scriptname.php
Then you can set the execution of the script in crontab.sh like any other
cron job.
("man crontab" and "man cron" to get the man pages)
HTH
Marc
> -----Original Message-----
> From: Adam Charnock [SMTP:adamcharnock@btinternet.com]
> Sent: Thursday, September 14, 2000 4:00 PM
> To: PHP Mailing List
> Subject: [PHP] PHP and Cron
>
> 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
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>