0

I am trying to run this cron import job but keep getting an error. It says the error is on line 40 but I am not seeing anything. I have changed several of the suggested items to only be returned with a new error. I need additional eyes on this.

else {
//** It seams cron service in CPanel works not like normal Linux Cron, so we  have to emulate $argv */
$VERBOSE = true;
if (!empty($_REQUEST) && array_key_exists('do_xml_import',$_REQUEST)){
 $argv = array_keys($_REQUEST);}
 }
 /** Need to at least have the do_xml_import argument */

Line 40 is actually the remComment, so I am sure the error is above it. This code is auto-generated by plugin that I am trying to work with.

I am including a link to the actual file as it is rather large.

cron file that is being used

Thanks for all the help!

  • Possible duplicate of [PHP Parse/Syntax Errors; and How to solve them?](http://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – gre_gor Sep 05 '16 at 12:48
  • While that post may answer the question - honestly it is a bit overwhelming. I posted because I need another set of eyes to help with this specific problem. I am hoping that I can get the help. I will certainly take the time to read the post above as it seems to be a virtual textbook of information – Eos the SeaCat Sep 05 '16 at 12:54

2 Answers2

1

OK! I've looked at the entire PHP file. The error I get is that memory is exhausted at line 42. Do you get the same?

I think this file was never meant to be run from the directly from the Command Line. It is meant to be run via Wordpress. It attempts to load the entire wordpress framework, but makes a mess of it it.

If you print the include call it makes when it tries to import wordpress, you will see the problem. Look at line 83:

  // Load WordPress - intentionally using an absolute URL due to issues with relative paths on the CLI.
  print "$wp_load_path\n";   /* <--- Add this line to see what's loading

  include $wp_load_path;

When I run it from the CLI, the script includes itself. And then it comes to this line and includes itself again. And again. And again. Until eventually the memory is exhausted. Then it bombs out.

I'm no WP expert, but I think it has its own cron system. You should check that out. Good luck!

Ben Hillier
  • 2,126
  • 1
  • 10
  • 15
0

It's hard to see from this partial example, but it could be that you close your if statement twice. Try this:

if (!empty($_REQUEST) && array_key_exists('do_xml_import',$_REQUEST)){
    $argv = array_keys($_REQUEST);
}
Ben Hillier
  • 2,126
  • 1
  • 10
  • 15