#1  
Old 5th December 2007, 02:16
bradhawk bradhawk is offline
Member
 
Join Date: Nov 2007
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Question PHP and Cron

Hello all,

I'm new to running scripts using Cron so I need some help.

I have a .php file that will run fine when I access it from the browser, but when I try and run it using the code 15 * * * * http://pathname.php.

I've also tried
wget -q --delete-after --http-user=user --http-passwd=password http://pathname.php.

Neither of which seem to work. Can someone lead me in the right direction to get this script to run using Cron? Thanks for any and all input!
Reply With Quote
Sponsored Links
  #2  
Old 5th December 2007, 03:15
Leszek Leszek is offline
Senior Member
 
Join Date: Nov 2006
Location: Poland,Włocławek
Posts: 369
Thanks: 22
Thanked 42 Times in 35 Posts
Send a message via Skype™ to Leszek
Default

Maybe You should try this:
Quote:
15 * * * * /path/to/php/binary /path/to/php/script &$
Reply With Quote
  #3  
Old 5th December 2007, 12:06
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,149
Thanks: 4
Thanked 56 Times in 52 Posts
Default

install the php5-cli package. That will allow you to run a php file from the command line.

Code:
10 * * * * php -f /path/to/php/file.php >/dev/null 2>&1
the >/dev/null 2>&1 will make no output or rather put it to /dev/null so that no email with the result is sent to the system user that uses this cron.
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
  #4  
Old 6th December 2007, 19:52
bradhawk bradhawk is offline
Member
 
Join Date: Nov 2007
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Default

So I contacted the webhost (Lunarpages) and they told me to run this command

Code:
10 * * * * php /path/to/php/file.php
The only problem I see is that the page that I'm trying to run is password protected. How do I deal with this?
Reply With Quote
  #5  
Old 7th December 2007, 13:47
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,149
Thanks: 4
Thanked 56 Times in 52 Posts
 
Default

make a copy of the .php file that is not password protected.
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CRON and .htaccess problems devilslayer General 1 23rd November 2007 17:49
mail_logs.php cron job causing high server loads? jameso General 15 3rd April 2007 12:18
Cron - PHP: Call to undefined function: gzinflate() safoo Server Operation 12 26th January 2007 18:49
file permissions in web directory are replaced by cron? mgyuri Installation/Configuration 2 12th January 2007 17:17
PHP Warning: fopen ... Trying to run from root, file is present, but can't be found? bpmee Server Operation 5 31st August 2006 10:36


All times are GMT +2. The time now is 04:29.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.