Re: Running a PHP script everyday

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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" <andre.caum@xxxxxxxxx>
To: <sub@xxxxxxxxx>
Cc: <php-general@xxxxxxxxxxxxx>
Sent: Saturday, July 30, 2005 10:35 AM
Subject: Re:  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, sub@xxxxxxxxx <sub@xxxxxxxxx> 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" <jmk@xxxxxxxxxxxxxxxxxxxxxxxxxx>
> To: <php-general@xxxxxxxxxxxxx>
> Sent: Saturday, July 30, 2005 10:07 AM
> Subject: Re:  Running a PHP script everyday
>
>
> > On Sat, Jul 30, 2005 at 09:17:20AM -0700, sub@xxxxxxxxx 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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux