Re: [PHP] Running a PHP script everyday
On 8/1/05, Jay Blanchard <[EMAIL PROTECTED]> wrote: > [snip] > What is the "-q" for? I can't find any documentation on it. If I do > a "php -h" or "man php", it is not listed. I am running php 5.0.3 on > RHEL ES 4 > [/snip] > > It means 'quiet'...in other words do not send anything to standard out. I'm open to correction but I think that normal output will still appear. It's only headers like Content-type, or Location, etc that the -q suppresses. echo's printf's and ?> this > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Running a PHP script everyday
At 09:56 AM 8/1/2005, you wrote: [snip] What is the "-q" for? I can't find any documentation on it. If I do a "php -h" or "man php", it is not listed. I am running php 5.0.3 on RHEL ES 4 [/snip] It means 'quiet'...in other words do not send anything to standard out. Thank You. I guess they are keeping "quiet" about letting people know about it. I would have thought that a "php -h" or "man php" would have given me the answer to that one. And since the poster said that he needed that to run the program, it never occurred to me that it was for "quiet" since that should not hinder him from running a program. Just keep him from getting a bunch of output. Of course, I might have total mis-understood him too. I have to much going on right now to remember. Anyway, thanks. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday [SOLVED]
[EMAIL PROTECTED] 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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; 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, [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
Don't forget also that if you're running on a Windows platform, you can use the php-win.exe to avoid having any console window appear at all. -TG = = = Original message = = = Steve Buehler wrote: > At 04:54 AM 8/1/2005, you wrote: > >> Shit shit shit!!! I completelly forgot! >> >> #!/usr/local/bin/php -q >> >> Notice the -q, it's important. >> >> Sorry :( > > > What is the "-q" for? I can't find any documentation on it. If I do a > "php -h" or "man php", it is not listed. I am running php 5.0.3 on RHEL > ES 4 It tells it to run quietly. Output nothing to STDOUT. ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
Steve Buehler wrote: At 04:54 AM 8/1/2005, you wrote: Shit shit shit!!! I completelly forgot! #!/usr/local/bin/php -q Notice the -q, it's important. Sorry :( What is the "-q" for? I can't find any documentation on it. If I do a "php -h" or "man php", it is not listed. I am running php 5.0.3 on RHEL ES 4 It tells it to run quietly. Output nothing to STDOUT. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Running a PHP script everyday
[snip] What is the "-q" for? I can't find any documentation on it. If I do a "php -h" or "man php", it is not listed. I am running php 5.0.3 on RHEL ES 4 [/snip] It means 'quiet'...in other words do not send anything to standard out. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
At 04:54 AM 8/1/2005, you wrote: Shit shit shit!!! I completelly forgot! #!/usr/local/bin/php -q Notice the -q, it's important. Sorry :( What is the "-q" for? I can't find any documentation on it. If I do a "php -h" or "man php", it is not listed. I am running php 5.0.3 on RHEL ES 4 Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
Shit shit shit!!! I completelly forgot! #!/usr/local/bin/php -q Notice the -q, it's important. Sorry :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday [SOLVED]
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 "/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 do that anyways. Thanks for all your help. Andrew Darrow Kronos1 Productions www.pudlz.com - Original Message - From: "Miles Thompson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; 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, [EMAIL PROTECTED] 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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, [EMAIL PROTECTED] 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
Re: [PHP] Running a PHP script everyday
That's not lame, it's just Windows version of cron. You can also set it up using "at" from the console, but it still shows up in Task Manager. M. At 04:03 PM 7/30/2005, M Saleh EG wrote: If you're on windows desktop try this... it might sound a lil lame but it works. Schedule a task to open IE or FF and pass a url to the task . That's it. The task will execute that page in a given interval. On 7/30/05, Rory Browne <[EMAIL PROTECTED]> wrote: > > If your script needs to be run by the webserver - if for some reason > cli won´t work for you, then you could always automate a call to the > webserver using wget. > > You can get wget for win32 as well as Unix/Linux, so you shouldn´t > have any problems here. > > On 7/30/05, André Medeiros <[EMAIL PROTECTED]> wrote: > > You can "cron" the script to run. > > > > Do the following: > > > > 1) Add #!/usr/bin/php as the first line on your .php file. If > > /usr/bin/php isn't where your php binary lives, type "whereis php" to > > find out > > 2) Make sure you chmod +x your php script. > > 3) http://www.linuxforums.org/tutorials/1/tutorial-4017.html > > > > On 7/30/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > In my pevious hunt through cron I didn't even notice the PHP CLI. So I > will be figuring that out today probably. > > > > > > My server runs on Linux. Not sure which distro though. I'll have to > ask. > > > > > > My script will be getting e-mail addresses from my SQL db and sending > them a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, > now I just need to figure out how to make it run without me doing anything. > > > > > > Thanks! > > > > > > Andrew Darrow > > > Kronos1 Productions > > > www.pudlz.com <http://www.pudlz.com> > > > > > > > > > - Original Message - > > > From: "James Kaufman" <[EMAIL PROTECTED]> > > > To: > > > Sent: Saturday, July 30, 2005 10:07 AM > > > Subject: Re: [PHP] Running a PHP script everyday > > > > > > > > > > On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 <http://www.pudlz.com> > > > > > > > > > > > > > You don't state what OS you are using, but you certainly can use > cron under > > > > Linux to run a PHP script. What really matters is what does the PHP > script do? > > > > For example, I have a PHP script that I run periodically that > retrieves data > > > > from a database and updates a text file on the disk. What does your > script do? > > > > > > > > -- > > > > Jim Kaufman > > > > Linux Evangelist > > > > public key 0x6D802619 > > > > CCNA, CISSP# 65668 > > > > > > > > -- > > > > 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 > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
My include statment looks like this: include "sending.php"; The ones from MimeMail are: are include(); and require_once(); Heres the response I get when using /usr/local/bin/php: /bin/sh: public_html/wap/mailer/dailylist.php: /usr/local/bin/php : bad interpreter: No such file or directory Maybe I'm messing up my syntax. I have: #!/usr/local/bin/php I did notice that when I FTP into my site I can not get to /usr or any of its' subfolders. Could this be an access issue? Andrew Darrow Kronos1 Productions www.pudlz.com - Original Message - From: "Robert Cummings" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "PHP-General" Sent: Saturday, July 30, 2005 3:47 PM Subject: Re: [PHP] Running a PHP script everyday > On Sat, 2005-07-30 at 18:21, [EMAIL PROTECTED] wrote: > > I can't figure out how to get into command line access through my webhost. > > I've tried telnet and it fails. > > > > My host uses cPanel. When I setup the crontab it e-mails me back this > > response: > > > > /bin/sh: public_html/wap/mailer/dailylist.php: /usr/bin/php > > : bad interpreter: No such file or directory > > > > I'm assuming that it means it can't find "/user/bin/php" > > > > I ran a "whereis php" through a cronjob and got this: > > > > php: /usr/src/php-4.3.8/php.ini-recommended /usr/src/php-4.3.8/php.ini-dist > > /usr/src/php-4.3.8/php.gif /usr/src/php-4.3.8/php4.spec > > /usr/src/php-4.3.10/php.ini-recommended /usr/src/php-4.3.10/php.ini-dist > > /usr/src/php-4.3.10/php.gif /usr/src/php-4.3.10/php4.spec /usr/bin/php > > /usr/lib/php /usr/lib/php.ini /usr/local/bin/php /usr/local/lib/php > > /usr/local/lib/php.ini /usr/include/php > > There it is in /usr/local/bin/php > > > I tried them all except the ones with "src" And still get the same message, > > but of course it doesn't say /user/bin/php, it says whichever one I put in > > the file. > > Are you sure you tried /usr/local/bin/php ?? > > > Now the main PHP file calls to 3 other PHP files in it. Do I need to put > > that at the top of each of them as well. I didn't think so because they > > aren't being executed. They are called using the include statement. > > No, but you will need to use one of the following for them: > > include() > include_once() > require() > require_once() > > > Also when I use #!/usr/include/php I get the response back from the cron > > job, but when I use "#!/usr/include/php -q" like the tutorial says nothing > > happens. What does the "-q" do? > > See: > > /usr/local/bin/php --help > > Cheers, > Rob. > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' > > > > > > -- > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
On Sat, 2005-07-30 at 18:21, [EMAIL PROTECTED] wrote: > I can't figure out how to get into command line access through my webhost. > I've tried telnet and it fails. > > My host uses cPanel. When I setup the crontab it e-mails me back this > response: > > /bin/sh: public_html/wap/mailer/dailylist.php: /usr/bin/php > : bad interpreter: No such file or directory > > I'm assuming that it means it can't find "/user/bin/php" > > I ran a "whereis php" through a cronjob and got this: > > php: /usr/src/php-4.3.8/php.ini-recommended /usr/src/php-4.3.8/php.ini-dist > /usr/src/php-4.3.8/php.gif /usr/src/php-4.3.8/php4.spec > /usr/src/php-4.3.10/php.ini-recommended /usr/src/php-4.3.10/php.ini-dist > /usr/src/php-4.3.10/php.gif /usr/src/php-4.3.10/php4.spec /usr/bin/php > /usr/lib/php /usr/lib/php.ini /usr/local/bin/php /usr/local/lib/php > /usr/local/lib/php.ini /usr/include/php There it is in /usr/local/bin/php > I tried them all except the ones with "src" And still get the same message, > but of course it doesn't say /user/bin/php, it says whichever one I put in > the file. Are you sure you tried /usr/local/bin/php ?? > Now the main PHP file calls to 3 other PHP files in it. Do I need to put > that at the top of each of them as well. I didn't think so because they > aren't being executed. They are called using the include statement. No, but you will need to use one of the following for them: include() include_once() require() require_once() > Also when I use #!/usr/include/php I get the response back from the cron > job, but when I use "#!/usr/include/php -q" like the tutorial says nothing > happens. What does the "-q" do? See: /usr/local/bin/php --help Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
I can't figure out how to get into command line access through my webhost. I've tried telnet and it fails. My host uses cPanel. When I setup the crontab it e-mails me back this response: /bin/sh: public_html/wap/mailer/dailylist.php: /usr/bin/php : bad interpreter: No such file or directory I'm assuming that it means it can't find "/user/bin/php" I ran a "whereis php" through a cronjob and got this: php: /usr/src/php-4.3.8/php.ini-recommended /usr/src/php-4.3.8/php.ini-dist /usr/src/php-4.3.8/php.gif /usr/src/php-4.3.8/php4.spec /usr/src/php-4.3.10/php.ini-recommended /usr/src/php-4.3.10/php.ini-dist /usr/src/php-4.3.10/php.gif /usr/src/php-4.3.10/php4.spec /usr/bin/php /usr/lib/php /usr/lib/php.ini /usr/local/bin/php /usr/local/lib/php /usr/local/lib/php.ini /usr/include/php I tried them all except the ones with "src" And still get the same message, but of course it doesn't say /user/bin/php, it says whichever one I put in the file. Now the main PHP file calls to 3 other PHP files in it. Do I need to put that at the top of each of them as well. I didn't think so because they aren't being executed. They are called using the include statement. Also when I use #!/usr/include/php I get the response back from the cron job, but when I use "#!/usr/include/php -q" like the tutorial says nothing happens. What does the "-q" do? Andrew Darrow Kronos1 Productions www.pudlz.com - Original Message - From: "André Medeiros" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Saturday, July 30, 2005 10:35 AM Subject: Re: [PHP] Running a PHP script everyday You can "cron" the script to run. Do the following: 1) Add #!/usr/bin/php as the first line on your .php file. If /usr/bin/php isn't where your php binary lives, type "whereis php" to find out 2) Make sure you chmod +x your php script. 3) http://www.linuxforums.org/tutorials/1/tutorial-4017.html On 7/30/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > In my pevious hunt through cron I didn't even notice the PHP CLI. So I will be figuring that out today probably. > > My server runs on Linux. Not sure which distro though. I'll have to ask. > > My script will be getting e-mail addresses from my SQL db and sending them a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I just need to figure out how to make it run without me doing anything. > > Thanks! > > Andrew Darrow > Kronos1 Productions > www.pudlz.com > > > - Original Message - > From: "James Kaufman" <[EMAIL PROTECTED]> > To: > Sent: Saturday, July 30, 2005 10:07 AM > Subject: Re: [PHP] Running a PHP script everyday > > > > On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 > > > > > > > You don't state what OS you are using, but you certainly can use cron under > > Linux to run a PHP script. What really matters is what does the PHP script do? > > For example, I have a PHP script that I run periodically that retrieves data > > from a database and updates a text file on the disk. What does your script do? > > > > -- > > Jim Kaufman > > Linux Evangelist > > public key 0x6D802619 > > CCNA, CISSP# 65668 > > > > -- > > 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 > > > > > -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
And how do you automate closing the browser when it's job is done? I believe the wget method mentioned earlier might be more appropriate. Even Lynx for Windows set to dump output (rather than stay open for browsing) would be better than leaving IE or FF open. M Saleh EG wrote: If you're on windows desktop try this... it might sound a lil lame but it works. Schedule a task to open IE or FF and pass a url to the task . That's it. The task will execute that page in a given interval. On 7/30/05, Rory Browne <[EMAIL PROTECTED]> wrote: If your script needs to be run by the webserver - if for some reason cli won´t work for you, then you could always automate a call to the webserver using wget. You can get wget for win32 as well as Unix/Linux, so you shouldn´t have any problems here. On 7/30/05, André Medeiros <[EMAIL PROTECTED]> wrote: You can "cron" the script to run. Do the following: 1) Add #!/usr/bin/php as the first line on your .php file. If /usr/bin/php isn't where your php binary lives, type "whereis php" to find out 2) Make sure you chmod +x your php script. 3) http://www.linuxforums.org/tutorials/1/tutorial-4017.html On 7/30/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: In my pevious hunt through cron I didn't even notice the PHP CLI. So I will be figuring that out today probably. My server runs on Linux. Not sure which distro though. I'll have to ask. My script will be getting e-mail addresses from my SQL db and sending them a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I just need to figure out how to make it run without me doing anything. Thanks! Andrew Darrow Kronos1 Productions www.pudlz.com <http://www.pudlz.com> - Original Message - From: "James Kaufman" <[EMAIL PROTECTED]> To: Sent: Saturday, July 30, 2005 10:07 AM Subject: Re: [PHP] Running a PHP script everyday On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 <http://www.pudlz.com> You don't state what OS you are using, but you certainly can use cron under Linux to run a PHP script. What really matters is what does the PHP script do? For example, I have a PHP script that I run periodically that retrieves data from a database and updates a text file on the disk. What does your script do? -- Jim Kaufman Linux Evangelist public key 0x6D802619 CCNA, CISSP# 65668 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
If you're on windows desktop try this... it might sound a lil lame but it works. Schedule a task to open IE or FF and pass a url to the task . That's it. The task will execute that page in a given interval. On 7/30/05, Rory Browne <[EMAIL PROTECTED]> wrote: > > If your script needs to be run by the webserver - if for some reason > cli won´t work for you, then you could always automate a call to the > webserver using wget. > > You can get wget for win32 as well as Unix/Linux, so you shouldn´t > have any problems here. > > On 7/30/05, André Medeiros <[EMAIL PROTECTED]> wrote: > > You can "cron" the script to run. > > > > Do the following: > > > > 1) Add #!/usr/bin/php as the first line on your .php file. If > > /usr/bin/php isn't where your php binary lives, type "whereis php" to > > find out > > 2) Make sure you chmod +x your php script. > > 3) http://www.linuxforums.org/tutorials/1/tutorial-4017.html > > > > On 7/30/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > In my pevious hunt through cron I didn't even notice the PHP CLI. So I > will be figuring that out today probably. > > > > > > My server runs on Linux. Not sure which distro though. I'll have to > ask. > > > > > > My script will be getting e-mail addresses from my SQL db and sending > them a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, > now I just need to figure out how to make it run without me doing anything. > > > > > > Thanks! > > > > > > Andrew Darrow > > > Kronos1 Productions > > > www.pudlz.com <http://www.pudlz.com> > > > > > > > > > - Original Message - > > > From: "James Kaufman" <[EMAIL PROTECTED]> > > > To: > > > Sent: Saturday, July 30, 2005 10:07 AM > > > Subject: Re: [PHP] Running a PHP script everyday > > > > > > > > > > On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 <http://www.pudlz.com> > > > > > > > > > > > > > You don't state what OS you are using, but you certainly can use > cron under > > > > Linux to run a PHP script. What really matters is what does the PHP > script do? > > > > For example, I have a PHP script that I run periodically that > retrieves data > > > > from a database and updates a text file on the disk. What does your > script do? > > > > > > > > -- > > > > Jim Kaufman > > > > Linux Evangelist > > > > public key 0x6D802619 > > > > CCNA, CISSP# 65668 > > > > > > > > -- > > > > 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 > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- M.Saleh.E.G 97150-4779817
Re: [PHP] Running a PHP script everyday
If your script needs to be run by the webserver - if for some reason cli won´t work for you, then you could always automate a call to the webserver using wget. You can get wget for win32 as well as Unix/Linux, so you shouldn´t have any problems here. On 7/30/05, André Medeiros <[EMAIL PROTECTED]> wrote: > You can "cron" the script to run. > > Do the following: > > 1) Add #!/usr/bin/php as the first line on your .php file. If > /usr/bin/php isn't where your php binary lives, type "whereis php" to > find out > 2) Make sure you chmod +x your php script. > 3) http://www.linuxforums.org/tutorials/1/tutorial-4017.html > > On 7/30/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > In my pevious hunt through cron I didn't even notice the PHP CLI. So I will > > be figuring that out today probably. > > > > My server runs on Linux. Not sure which distro though. I'll have to ask. > > > > My script will be getting e-mail addresses from my SQL db and sending them > > a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I > > just need to figure out how to make it run without me doing anything. > > > > Thanks! > > > > Andrew Darrow > > Kronos1 Productions > > www.pudlz.com > > > > > > - Original Message - > > From: "James Kaufman" <[EMAIL PROTECTED]> > > To: > > Sent: Saturday, July 30, 2005 10:07 AM > > Subject: Re: [PHP] Running a PHP script everyday > > > > > > > On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 > > > > > > > > > > You don't state what OS you are using, but you certainly can use cron > > > under > > > Linux to run a PHP script. What really matters is what does the PHP > > > script do? > > > For example, I have a PHP script that I run periodically that retrieves > > > data > > > from a database and updates a text file on the disk. What does your > > > script do? > > > > > > -- > > > Jim Kaufman > > > Linux Evangelist > > > public key 0x6D802619 > > > CCNA, CISSP# 65668 > > > > > > -- > > > 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 > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
You can "cron" the script to run. Do the following: 1) Add #!/usr/bin/php as the first line on your .php file. If /usr/bin/php isn't where your php binary lives, type "whereis php" to find out 2) Make sure you chmod +x your php script. 3) http://www.linuxforums.org/tutorials/1/tutorial-4017.html On 7/30/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > In my pevious hunt through cron I didn't even notice the PHP CLI. So I will > be figuring that out today probably. > > My server runs on Linux. Not sure which distro though. I'll have to ask. > > My script will be getting e-mail addresses from my SQL db and sending them a > pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I just > need to figure out how to make it run without me doing anything. > > Thanks! > > Andrew Darrow > Kronos1 Productions > www.pudlz.com > > > - Original Message - > From: "James Kaufman" <[EMAIL PROTECTED]> > To: > Sent: Saturday, July 30, 2005 10:07 AM > Subject: Re: [PHP] Running a PHP script everyday > > > > On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 > > > > > > > You don't state what OS you are using, but you certainly can use cron under > > Linux to run a PHP script. What really matters is what does the PHP script > > do? > > For example, I have a PHP script that I run periodically that retrieves data > > from a database and updates a text file on the disk. What does your script > > do? > > > > -- > > Jim Kaufman > > Linux Evangelist > > public key 0x6D802619 > > CCNA, CISSP# 65668 > > > > -- > > 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 > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
[EMAIL PROTECTED] wrote: In my pevious hunt through cron I didn't even notice the PHP CLI. So I will be figuring that out today probably. My server runs on Linux. Not sure which distro though. I'll have to ask. My script will be getting e-mail addresses from my SQL db and sending them a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I just need to figure out how to make it run without me doing anything. Thanks! Andrew Darrow Kronos1 Productions www.pudlz.com - Original Message - From: "James Kaufman" <[EMAIL PROTECTED]> To: Sent: Saturday, July 30, 2005 10:07 AM Subject: Re: [PHP] Running a PHP script everyday On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 You don't state what OS you are using, but you certainly can use cron under Linux to run a PHP script. What really matters is what does the PHP script do? For example, I have a PHP script that I run periodically that retrieves data from a database and updates a text file on the disk. What does your script do? -- Jim Kaufman Linux Evangelist public key 0x6D802619 CCNA, CISSP# 65668 -- 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 http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/custom-guide/cron-task.html Unless you have a shebang line ("#!/path/to/php/binary")at the top of your script, you will have to preface your script's path in your cron entry with the location of the PHP binary: 0 1 1,15 * * /path/to/php/binary /root/scripts/System_Dump.php Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
In my pevious hunt through cron I didn't even notice the PHP CLI. So I will be figuring that out today probably. My server runs on Linux. Not sure which distro though. I'll have to ask. My script will be getting e-mail addresses from my SQL db and sending them a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I just need to figure out how to make it run without me doing anything. Thanks! Andrew Darrow Kronos1 Productions www.pudlz.com - Original Message - From: "James Kaufman" <[EMAIL PROTECTED]> To: Sent: Saturday, July 30, 2005 10:07 AM Subject: Re: [PHP] Running a PHP script everyday > On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 > > > > You don't state what OS you are using, but you certainly can use cron under > Linux to run a PHP script. What really matters is what does the PHP script do? > For example, I have a PHP script that I run periodically that retrieves data > from a database and updates a text file on the disk. What does your script do? > > -- > Jim Kaufman > Linux Evangelist > public key 0x6D802619 > CCNA, CISSP# 65668 > > -- > 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 > >
Re: [PHP] Running a PHP script everyday
On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] 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 > You don't state what OS you are using, but you certainly can use cron under Linux to run a PHP script. What really matters is what does the PHP script do? For example, I have a PHP script that I run periodically that retrieves data from a database and updates a text file on the disk. What does your script do? -- Jim Kaufman Linux Evangelist public key 0x6D802619 CCNA, CISSP# 65668 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Running a PHP script everyday
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