Jump to content

[SOLVED] [Solved] cron


R1der

Recommended Posts

I dont know if i am in the right place to post this.

Ok i am trying to run a cron but keep getting a error come in my inbox. i am very new to using crons.

This is the error

/home/lostcity/public_html/crons/cron24r.php: line 1: ?: No such file or directory/home/lostcity/public_html/crons/cron24r.php: line 2: syntax error near unexpected token `('/home/lostcity/public_html/crons/cron24r.php: line 2: `$db->query("UPDATE users SET uAttackTurns=uAttackTurns+2 WHERE uAttackTurns<uAttackTurnsMax AND (uType=1 OR uType=2)");

This is my code

[code]<?
$db->query("UPDATE users SET uAttackTurns=uAttackTurns+2 WHERE uAttackTurns<uAttackTurnsMax AND (uType=1 OR uType=2)");
?>[/code]

Any ideas?
Link to comment
Share on other sites

if you're trying to run the file directly in a CRON, you need to add this line to the top:

[code]#!/usr/bin/php -q
<?php
// php here
?>[/code]

this tells the command line to parse the following PHP code with the php engine (as far as i know), in quiet mode which suppresses the headers.  the /usr/bin/php might need to change depending on your hosting setup.  check phpinfo() for the proper path if this doesn't work.
Link to comment
Share on other sites

[quote author=akitchin link=topic=111511.msg451954#msg451954 date=1160863637]
if you're trying to run the file directly in a CRON, you need to add this line to the top:

[code]#!/usr/bin/php -q
<?php
// php here
?>[/code]

this tells the command line to parse the following PHP code with the php engine (as far as i know), in quiet mode which suppresses the headers.  the /usr/bin/php might need to change depending on your hosting setup.  check phpinfo() for the proper path if this doesn't work.
[/quote]

So i add that to crontab.txt or cron24r.php?


And thx for the replys
Link to comment
Share on other sites

Well i just did what akitchin said.

[quote]if you're trying to run the file directly in a CRON, you need to add this line to the top:


Code:
#!/usr/bin/php -q
<?php
// php here
?>
this tells the command line to parse the following PHP code with the php engine (as far as i know), in quiet mode which suppresses the headers.  the /usr/bin/php might need to change depending on your hosting setup.  check phpinfo() for the proper path if this doesn't work.

[/quote]

But it worked fine for a few days then i started getting another error in my mailbox

This is the error

Error in argument 1, char 3: option not found 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>.

Anyone understand this? If so any ideas to fix it?

Thanks for your time
Link to comment
Share on other sites

as far as i know, it means that it thinks 'q' is an option that doesn't exist.  i've gotten that error before and frankly, i don't know why it comes back seeing as in the usage explanation it clearly shows 'q' as a legit option.

someone who's good with linux command line care to help out here?
Link to comment
Share on other sites

I'm afraid I don't see the -q switch in my php -h, and don't see any flags to enable when you ./configure, am I missing something?

And out of curiosity, why do we need to suppress headers? Are there even going to be any headers sent, since it's being run through the CLI?
Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.