Search code examples
phpwordpresscroncron-task

How do I find and fix a t-string error in cron.php


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!


Solution

  • 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!