Page 1 of 2

Cron error [solved]

Posted: Wed Jan 27, 2016 9:16 pm
by krang
Hi,

I setup my cron for root user like this:

Code: Select all

0 */4 * * * /usr/bin/php -q /var/www/blahblahblah/cron/tick_update.php > /dev/null
it looks to work fine but it shows error:

Code: Select all

PHP Notice:  Undefined index: HTTP_HOST in /var/www/blahblahblah/inc/config.inc.php on line 89
ekhm I know I can use

Code: Select all

/dev/null 2>&1
and I will don't get any email notifications but I would like to know is this some issue and how to solve error message?

Also why do I need add -q parameter, it's in BitShop setup instruction.

Thanks

Re: Cron error

Posted: Thu Jan 28, 2016 12:31 pm
by bitfreak
That error probably means you're running on a server without a host name. Replace the $_SERVER['HTTP_HOST'] variable with the server IP and it should work. And I think the -q parameter means quiet mode, should stop the email notifications or something like that.

Re: Cron error [solved]

Posted: Mon Mar 14, 2016 10:46 am
by johnny508
Can u guys help me understand something.. I always struggle keeping crinjobs for bitcoin apis working properly.

I know how to run a cron job with command similar to one above.

And i can see it running and it looks like the place its reaching out to successfully connected, etc.

But i struggle to understand how to check if the returned data is coming back and going into the proper places on my webshop.

Is there some command switch that would allow me to see what is being returned and where it going?

Are there switches that u guys would recommend researching as the most commonly used switches!

Re: Cron error [solved]

Posted: Sat Mar 19, 2016 5:26 am
by bitfreak
@johnny508: take a look at the /cron/tick_update.php file, the data returned is saved to $json_result and then a quick check is done to make sure it returned valid data.

Re: Cron error

Posted: Sat Jul 02, 2016 3:10 pm
by krang
bitfreak wrote:That error probably means you're running on a server without a host name. Replace the $_SERVER['HTTP_HOST'] variable with the server IP and it should work. And I think the -q parameter means quiet mode, should stop the email notifications or something like that.
I did this in line:
$http_host = empty($_SERVER['HTTP_HOST']) ? server_name() : $_SERVER['HTTP_HOST'];

and changed $_SERVER['HTTP_HOST'] for ip of my server here empty($_SERVER['HTTP_HOST']) and empty($_SERVER['HTTP_HOST'])
I am not sure it should be changed in both places but I tried only at the beginning then at the end and all 3 solutions doesn't work.

error:
PHP Parse error: syntax error, unexpected '.115' (T_DNUMBER) in /var/www/pawnshop/inc/config.inc.php on line 100

115 is part of my ip address

Re: Cron error [solved]

Posted: Mon Jul 04, 2016 8:31 am
by krang
I see on your main page of BitShop, Bitcoin rate is also out of date.

Maybe it is something about mod_rewrite rules? I am using Lighttpd server so maybe I need create some because Lighttpd using own syntax.
Anyway even if it is not about rewrite could you please create list of mod_rewrite rules for BitShop for Lighttpd?

Or how I can setup Http_Host? I know Server_Name can be added to webserver conf. But Http_host is something from Http request header.

Re: Cron error [solved]

Posted: Wed Jul 13, 2016 10:58 am
by bitfreak
error:
PHP Parse error: syntax error, unexpected '.115' (T_DNUMBER) in /var/www/pawnshop/inc/config.inc.php on line 100

115 is part of my ip address
The newest version of BitShop should have fixed this problem for you automatically, but to give you a solution for earlier versions, you probably need to put your IP address inside quotes.
I see on your main page of BitShop, Bitcoin rate is also out of date.
Thanks for pointing that out, seems there is some sort of issue with the cron job stuff, I'll look into it shortly.

EDIT: Ok it looks like the issue is a permission issue. It depends on your server settings, but usually cron jobs won't run the script as the apache user so it wont have permission to edit the weighted_prices.json file since the weighted_prices.json file is usually owned by the apache user. It could be quickly fixed by applying less restrictive permissions to the weighted_prices.json file but that may open up security holes. I'll see if I can come up with a better solution and include it in the next version of BitShop.

Re: Cron error [solved]

Posted: Wed Jul 13, 2016 12:18 pm
by krang
I tried with quotes double " and single ' but still nothing. For temporary solution I just paste path to tick_update.php into browser and it works and update bitcoin status.
I would not like to add ip into any script file inside www folder because my shop is running as a hidden service in Tor.

Fingers crossed for any other solution :)

Re: Cron error [solved]

Posted: Wed Jul 13, 2016 1:22 pm
by bitfreak
krang wrote:I tried with quotes double " and single ' but still nothing.
If you're using v1.1.1 then it should automatically work without having to add your IP address.

Re: Cron error [solved]

Posted: Thu Jul 14, 2016 3:13 pm
by krang
Could you please give me an example on line below, how it should looks like? Would you be so nice and put any IP in line below to show me how it should be configured?

$http_host = empty($_SERVER['HTTP_HOST']) ? server_name() : $_SERVER['HTTP_HOST'];

Thanks in advanced!