You are here: Re: [PHP] Running a PHP script everyday [SOLVED] « PHP « IT news, forums, messages
Re: [PHP] Running a PHP script everyday [SOLVED]

Posted by Jochem Maas on 08/01/05 20:48

sub@pudlz.com wrote:
> What a convoluted mess.
>
> Rather than using the shebang at the begging of the PHP file I had to put it
> in the cron command

the shebang only works if you make the file executable...
do something _like_:

$> chmod ug+x /path/to/your/php/file

> "/usr/local/bin/php public_html/wap/mailer/dailylist.php"
>
> It will now run.
>
> But then I had to slightly redesign the HTMLMimeMail code. I had to define
> some of it as functions and include the file as a function definition rather
> than include the direct code. I also had to change my include statements to
> this "include "public_html/wap/mailer/sending.php";" With this type of
> include I can no longer run it from a browser, but I really didn't want to

exactly what 'kind' of include is that then - looks normal to me.

maybe you need to learn a bit about how include works, what the 'current working
directory' is (and how this differs between CLI and SAPI versions), and how
the include_path ini setting affects the use of [include|require](_once)?

that said I've sometimes had to have script that runs off the cmdline and via a browser
and it can be a bit of PITA to get to work flawlessly in both envs :-)

.... as long as it works heh! :-)

> do that anyways.
>
> Thanks for all your help.
>
> Andrew Darrow
> Kronos1 Productions
> www.pudlz.com
>
>
> ----- Original Message -----
> From: "Miles Thompson" <miles@allnovascotia.com>
> To: <sub@pudlz.com>; <php-general@lists.php.net>
> Sent: Saturday, July 30, 2005 5:57 PM
> Subject: Re: [PHP] Running a PHP script everyday
>
>
>
>>If you're on Windows, use Task Manager and have it start an instance of a
>>web browser, with your URL and script passed to it.
>>or
>>Cron job on server, if you have that level of access.
>>
>>Miles
>>
>>
>>At 01:17 PM 7/30/2005, sub@pudlz.com wrote:
>>
>>>I have a PHP script that I need to run once a day. I have it currently
>>>setup so that I just run it from my cell phone, but I would prefer
>
> something
>
>>>automated. I'd looked into a cron job, but that just looks like it's for
>>>doing linux command line stuff on my host.
>>>
>>>I also thought about writing a never ending while loop with an if
>
> statement
>
>>>that checks to see if it's time to run the script, then when it is time,
>
> it
>
>>>runs. Then checks to see if it's time again.
>>>
>>>But even assuming I could get it working, do I really want to have a PHP
>>>script that runs all the time. This could be bad if it ate up all the CPU
>
> on
>
>>>my server. I'm not even sure I have access rights to kill the process
>
> once I
>
>>>start it.
>>>
>>>Any suggestions?
>>>
>>>Andrew Darrow
>>>Kronos1 Productions
>>>www.pudlz.com
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>>
>>--
>>No virus found in this incoming message.
>>Checked by AVG Anti-Virus.
>>Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005
>>
>>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация