Trying to get a cron job working on qiq.co.uk
Right, i have a wee php file that i want to run daily, the code is fine (i've tried running it manually, no problems there), but for the life of me i can't understand what path my hosting company (qiq.co.uk) want to the file.
It gives the example:
/home/sites/YOUR DOMAIN/public_html/test.pl
So.. i've tried replacing the necessaries with where my file is - no avail. I've tried just putting /includes/cron.php, public_html/includes/cron.php and failing that, even a http link to the file - which then threw up the error "File or directory does not exist".
Anyone else used Qiq for this?
Re: Trying to get a cron job working on qiq.co.uk
i've never contemplated using PHP for scripting. is your page marked as executable (+x permission)? it can't just be executed unless it has that permission
Re: Trying to get a cron job working on qiq.co.uk
If you want to use a PHP for a cron job, you need to have the following right at the top of the script:
Or whatever the correct path to the php shell binary is at, and as above, make sure it has the +x bit enabled.
Re: Trying to get a cron job working on qiq.co.uk
Aha right :)
I've set it to go at half past.. so i shall wait and see.
@Hex, i'm using the PHP to update values in a database (i'm learning PHP via making a game :P), ie users' HP every hour. Congrats on your 10001th post btw ;)
Re: Trying to get a cron job working on qiq.co.uk
Ok nearly got it sussed.
So, would this be the correct syntax:
Code:
/usr/bin/php php -f /home/sites/path/to/my/cron.php
?
(sorry for being so dim about this, i really haven't got a clue what i'm doing here :D)
This is what the email output came up with:
Quote:
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
php <file> [args...]
-a Run interactively
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
Re: Trying to get a cron job working on qiq.co.uk
Quote:
Originally Posted by
Whiternoise
Ok nearly got it sussed.
So, would this be the correct syntax:
Code:
/usr/bin/php php -f /home/sites/path/to/my/cron.php
?
(sorry for being so dim about this, i really haven't got a clue what i'm doing here :D)
This is what the email output came up with:
you've got a stray "php" there.
"command arguments"
the command is "/usr/bin/php", the arguments are "-f /home/sites/path/to/my/cron.php"
/usr/bin/php -f /home/sites/path/to/my/cron.php
Re: Trying to get a cron job working on qiq.co.uk
Finally got it! :D
Thanks mate, you're a life saver!
Re: Trying to get a cron job working on qiq.co.uk
quick side - sticking that script in the public_html dir so that anyone can see it or get to it if they wanted may not be the best move in the long run.
It may be fine, but just check up in your own head if its the right place to put it for security on your server.
Re: Trying to get a cron job working on qiq.co.uk
Use scripted php at work with cron rather cleverly to provide an online ticketing system. It's quite a useful little systems programming language.
Re: Trying to get a cron job working on qiq.co.uk
used to use php via cron to poll a few natural selection games servers for me + some mates.
worked very well until the php version became updated :(
remeber your probably running outside of safe mode when you do this, vrs running inside safe mode on your httpd.
As such you really must make sure your running it as a fully restricted user.
Re: Trying to get a cron job working on qiq.co.uk
Quote:
Originally Posted by
ikonia
quick side - sticking that script in the public_html dir so that anyone can see it or get to it if they wanted may not be the best move in the long run.
It may be fine, but just check up in your own head if its the right place to put it for security on your server.
Yeah, currently it's in the directory above public_html, the links above were for example :)
Re: Trying to get a cron job working on qiq.co.uk