Googlemaps geocoding cron marked as executed but doesnt geocode anything

@pgr,

After checking in the database, I can see that the registered datetime of the CRON is wrong by -1h .

on the 07/01/2020 at 15h in job_queue table, execute_time I have this :
2020-01-07 14:00:00

so its minus 1hour, maybe it can come from here.

In the user time zone everyone is on Europe/Paris (GMT +1:00)
php ini data : date.timezone = Europe/Paris;
In SSH if I type date I have the correct date time too :thinking:

If you type

php -i | grep timezone

do you get the same result as looking in

Admin / Diagnostics / phpinfo

:question:

The phpinfo from the diagnotics is correct (got paris too)

But the request grep/display nothing in SSH in the suitecrm folder.

Are you sure?

php -i doesn’t work?

Is your php in the PATH?

The php.ini file is in the root folder of my suitecrm instance

PHP -i display a raw html code,

If I c/c it in a html file and open it I can read " PHP Version 4.4.9"

Damn I cant understand how this work ahah

But if a search for timzone in this file, cant find nothing.

All my website are actually in php 7.3

EDIT : I have specified in all my cron the php version to run with, and its 7.1

The problem is that your web server PHP set up is ok, but your command-line PHP (CLI) isn’t. And this is what is used for the Scheduler Jobs, including the Geocoding one.

This should tell you which PHP it’s executing from command line:

which php

And then you can also know which php.ini that executable is using (you can define a timezone there, although I think first you should point this to a newer executable):

php -i | grep php.ini

You can search for ALL PHP executables in your system:

sudo find / -name php 2>/dev/null

Then it’s a matter of picking the right one, and making sure your PATH points to it first.

I am getting somewhere…

I my crontab I have specified the php version :

          • php7.1 /xxxxx/xx/xxxxx/xxxxxxxxxx/SuiteCRM/cron.php > /dev/null 2>&1

Now I am commenting on every update line 50 to 53 in cron.php :

$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) != ‘cli’) {
sugar_die(“cron.php is CLI only.”);
}

If I don’t comment them CRON is not running. (Got the info from here : cron help! (1and1 shared server))

I think it’s because I should use the -cli version of my host. like this :

          • /usr/bin/php7.3-cli /xxxxx/xx/xxxxx/xxxxxxxxxx/SuiteCRM/cron.php > /dev/null 2>&1

As a complete beginner I was thinking just specify the php version before was ok, didn’t know about CLI version.

EDIT :
just saw your answer from here : Need to solve SMTP problem with 1and1

you asked him to use this cron :

          • cd /path/to/suitecrm/folder/; usr/bin/php7.1-cli -d date.timezone=“America/New_York” -f /path/to/root/folder/cron.php > /dev/null 2>&1

I am also on a 1&1 shared hosting so maybe I should use this one too ?

Just add those elements if they are needed.

  • The path was added because otherwise it couldn’t find the PHP executable, or wasn’t using the correct one;

  • the timezone setting was added as a parameter because there was no way to edit a php.ini

1 Like

Okay so I’ve tried with :

/usr/bin/php7.3-cli /xxxxx/xx/xxxxx/xxxxxxxxxx/SuiteCRM/cron.php > /dev/null 2>&1

It changed nothing it execute the cron with 7.3-cli and put the geocode cron on success in job_queue. Same minus 1 hour on the execute time. Geocode still not doing hes job.

I can see that it use the good php.ini in the diag of the CRM. And so, the good timezone in it.

I will try to put the log on default during 24h …

Edit :
Do you think I have to try something like this ?
cd /xxxxxxxx/xxxxx/xxxxx/xxx/SuiteCRM; php -f cron.php > /dev/null 2>&1

Or maybe I have to specify the php version like this:
cd /xxxxxxxx/xxxxx/xxxxx/xxx/SuiteCRM; php7.3-cli -f cron.php > /dev/null 2>&1

Do you know how to fix that ?


The log time is good 15h26, but the log time is 14h26… Dont think the issue come frome here but I will test everything to make it work.

While debugging I found this ->

Thu Jan 9 16:00:02 2020 [12344][1][DEBUG] ----->SchedulersJob firing URL job: https://xxxxxxxxxxxxxx/index.php?module=jjwg_Maps&entryPoint=jjwg_Maps&cron=1

my cron is saved like this in the scheduler ->
https://xxxxxxxxxxxxxx/index.php?module=jjwg_Maps&entryPoint=jjwg_Maps&cron=1

ofc after I have this ->

Thu Jan 9 16:00:02 2020 [12344][1][DEBUG] ----->Firing was successful: https://xxxxxxxxxxxxxx/index.php?module=jjwg_Maps&entryPoint=jjwg_Maps&cron=1
Thu Jan 9 16:00:02 2020 [12344][1][DEBUG] ----->WTIH RESULT: HTTP/1.1 301 Moved Permanently

So its an encode issue of the URL … He is trying to access to a URL that doesnt exist…

But why he mark it as success in the job_queue so ?

Thu Jan 9 16:00:02 2020 [12344][1][INFO] Resolving job 9a8af89d-8030-638e-a62a-5e173f70ce54 as success:
Thu Jan 9 16:00:02 2020 [12344][1][DEBUG] Hook called: SchedulersJobs::before_save
Thu Jan 9 16:00:02 2020 [12344][1][INFO] Query:UPDATE job_queue
SET assigned_user_id=‘1’,name=‘Google Maps Geocoding Process’,date_modified=‘2020-01-09 15:00:01’,scheduler_id=‘648ef1e9-704f-96c9-e789-5d02083b48e2’,execute_time=‘2020-01-09 15:00:00’,status=‘done’,resolution=‘success’,message=NULL,target=‘url::https://xxxxxxxxxxxxxx/index.php?module=jjwg_Maps&entryPoint=jjwg_Maps&cron=1’,data=NULL,requeue=0,retry_count=NULL,failure_count=NULL,job_delay=0,client=‘CRONa0af2a63b6342f94d4a6e68c780ac405:12344’,percent_complete=NULL
WHERE job_queue.id = ‘9a8af89d-8030-638e-a62a-5e173f70ce54’ AND deleted=0

It just accepts any HTTP code below 400 from the server as a response. Only when the call fails to actually execute at all, does it return an error.

You just try to find out why it’s giving you a 301. Check your web server and your htaccess

Maybe for the 301 redirects, it needs to have extra code to get the redirected URL and fire a second request. Bu that code is not there yet.

1 Like

The 301 error is cause due to the fact he’s trying to access to this :
https://xxxxxxxxxxxxxx/index.php?module=jjwg_Maps&entryPoint=jjwg_Maps&cron=1

instead of this :
https://xxxxxxxxxxxxxx/index.php?module=jjwg_Maps&entryPoint=jjwg_Maps&cron=1

So ofc the link doesnt work, and he redirect to the login page.

Its correctly saved in the schedulers table :
url::https://xxxxxxxx.com/index.php?module=jjwg_Maps&entryPoint=jjwg_Maps&cron=1

So I dont know from where it come.

This is a value you create in a custom Scheduler, right? So you can check if it is correctly saved in the database, in the schedulers table.

Then check how it reaches this point in the code where it seems to be used:

I’ve already looked into the table, its saved well…

Ofc I can debug the SchedulersJob.php, will try to log the $exJob value !

Any solution for the 301 problem until now. I run into the same trouble. I´ve checked the database, URL looks fine. But if i check the log it shows something different. If i start the job by direct link it worked well, but is doing only 100 addresses at one time.

Just an update. To solve the problem at now i used Easycron to fire the URL every 10 minutes. Works for me at now. But i hope it will be solved in the future.

I had to do the same, use another CRON tool cause the one in the CRM doesnt worked…

I think we have to open a github issue about this.

Just to know, where are you living ? Its maybe an encode issue …

Hi, i am from Germany but setup the system for my colleagues at France.

Im from France too… Maybe a hint about how to fix this. Pretty sure its an encode issue.

I ill check this: Change SchedulersJob.php.

But it is only a quick and dirty solution. Of course the general problem need to be solved.

1 Like