Running PHP File under Crontab...

mikel king mikel.king at olivent.com
Sun Jan 17 23:13:30 UTC 2010


There are a couple of ways. My prefrence is to control the output  
directly from the app in PHP. However you should be able to pipe the  
output to a file without issue.

Cheers,
m!

On Jan 17, 2010, at 15:48, Diego Montalvo <dmontalvo at gmail.com> wrote:

> One other question,  is there a way to copy the ouput of the crontab
> "php" file to another file?
>
> Simply the "hello world" output and not the <?php?> code... ??
>
> 2010/1/17 mikel king <mikel.king at olivent.com>:
>>
>> On Jan 17, 2010, at 3:01 PM, Diego Montalvo wrote:
>>
>>> I am using "<?php #!/bin/sh ?>
>>>
>>> 2010/1/17 mikel king <mikel.king at olivent.com>:
>>>>
>>>> On Jan 17, 2010, at 2:30 PM, Diego Montalvo wrote:
>>>>
>>>>> CLI meaning, if I can run and excute <?php echo 'hello world';?>  
>>>>> in
>>>>> command line,  a php file can run in crontab?  doing the  
>>>>> following in
>>>>> shell: "# php helloworld.php" - "hello world" is produced...
>>>>>
>>>>> Thanks!
>>>>>
>>>>>
>>>>
>>>>
>>>> ok then do you have #!/usr/local/bin/php as your first line of the
>>>> script?
>>>> Or are you using the bash exec command to run the code in your  
>>>> shell
>>>> script?
>>>>
>>>> Also you can try placing the path to the php CLI executable in the
>>>> crontab.
>>
>>
>> If your php executable is in /usr/local/bin then replace /bin/sh  
>> with that
>> in your script file.
>>
>> #!/usr/local/bin/php
>>
>> <?php
>>
>>        echo "Hello cruel world!!!\n";
>>
>> ?>
>>
>> Remember to chmod +x the script file.
>>
>> m!
>>
>>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org 
> "



More information about the freebsd-questions mailing list