View Full Version : Running PHP Scripts on CRON
DarkFenix
10-25-2003, 02:33 PM
i can't running php scripts on cron... can anyone help me with this??
i try this:
Minute 0,5,10,15,20,25,30,35,40,50,55
Hour *
Day of Month *
Month *
Day of Week *
and the command:
/home/dktech/domains/mydomain/public_html/script.php
or
php /home/dktech/domains/mydomain/public_html/script.php
doesn't happen anythink... why?
tks for any help please :|
DirectAdmin Support
10-26-2003, 11:00 PM
Hello,
php scripts arn't executable as they are unless they either have:
#!/usr/local/bin/php
at the top of the file, or you have the cron command set as:
/usr/local/bin/php /home/dktech/domains/mydomain/public_html/script.php
John
DarkFenix
10-27-2003, 11:19 AM
tks for help me, i will see now if that works... Thanks :)
hostpc.com
10-27-2003, 03:22 PM
We use (in crontab)
5 * * * * wget http://www.domain.com/path/to/cron > /dev/null 2>&1
That does a physical "touch" of the page... similar to above, but you dont have to have the wrapper.
Hope that helps.
Joe
bob_gps
10-18-2006, 05:36 AM
After starting by cron my php script I receive following message:
"Warning: fopen(/home/name/domains/site.com/public_html/folder/file):
failed to open stream: Permission denied"
If I run this script from browser it works.
File attributes 666. Where I'm wrong?
sullise
11-15-2006, 01:01 PM
Look in your php.ini and see if you have url_fopen disabled.
hostpc.com
11-15-2006, 01:02 PM
chmod 755 filename.php
sullise
11-15-2006, 01:04 PM
lol..didn't see the 666..yeah..what Joe said there..
redesb
12-23-2006, 09:52 PM
If you use 'wget' is better to add the '-O -' option for don't get writed the downloaded file to the disk, only to 'stdout' and if your file is in one protected dir you can add the options '--http-user=USERNAME --http-password=PASS', see bellow:wget -O - --http-user=USERNAME --http-password=PASS http://www.example.com/protected/script.php > /dev/null 2>&1But as security option I have 'wget' disabled to all users except root, and I prefer to use 'lynx' (more secure) like this:lynx -dump -auth=ID:PASS http://www.example.com/protected/script.php > /dev/null 2>&1The '-dump' option is for get the output on 'stdout' and the '-auth=ID:PASS' because I have the script in one protected dir, omit if not your case.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.