0

I'm getting 500 errors running something like this:

http://www.mysite.com/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=cronuser&pass=mypass&key=mykey

This is an example of the error, which the web host tech support sent to me:

207.118.16.184 - - [11/Jun/2017:12:44:03 -0700] "GET /wp-content/plugins/civicrm/civicrm/bin/cron.php?name=cronuser&pass=mypass&key=mykey HTTP/1.1" 500 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"

When I run the command in cpanel cron (using wget -O -q -t 1), the email that the Cron Daemon sends me looks like this:

--2017-06-11 14:05:01--  http://www.mysite.com/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=cronuser
Resolving www.mysite.com (www.mysite.com)... 12.345.678.9
Connecting to www.mysite.com (www.mysite.com)|12.345.678.9|:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2017-06-11 14:05:01 ERROR 500: Internal Server Error.

It looked to me like, in cron.php, the last three of the four requires shown below were wrong and needed an additional ../ to find the files. So I edited cron.php to change that, but continued to get 500 errors.

require_once '../civicrm.config.php';

require_once 'CRM/Core/Config.php'; --> changed to '../CRM/Core/Config.php'

require_once 'CRM/Utils/Request.php'; --> changed to '../CRM/Utils/Request.php'

require_once 'CRM/Core/JobManager.php';--> changed to '../CRM/Utils/Request.php'

So I created a test file, cron_requires.php, shown below. The hello prints out, the file_exists() statements find the files, but I'm still getting 500 errors:

<?php
echo nl2br ("hello\n\n");
$filename1 = '../civicrm.config.php';
$filename2 = '../CRM/Core/Config.php';
$filename3 = '../CRM/Utils/Request.php';
$filename4 = '../CRM/Core/JobManager.php';

if (file_exists($filename1)) {
    echo nl2br ("The file $filename1 exists\n");
} else {
    echo nl2br ("The file $filename1 does not exist\n");
}
if (file_exists($filename2)) {
    echo nl2br ("The file $filename2 exists\n");
} else {
    echo nl2br ("The file $filename2 does not exist\n");
}
if (file_exists($filename3)) {
    echo nl2br ("The file $filename3 exists\n");
} else {
    echo nl2br ("The file $filename3 does not exist\n");
}
if (file_exists($filename4)) {
    echo nl2br ("The file $filename4 exists\n");
} else {
    echo nl2br ("The file $filename4 does not exist\n");
}
require_once '../civicrm.config.php';
require_once '../CRM/Core/Config.php';
require_once '../CRM/Utils/Request.php';
require_once '../CRM/Core/JobManager.php';
?>

===== added June 12 ======

Following advice to enable PHP errors, it seems perhaps CiviCRM is failing to locate civicrm.settings.php on boot.

Specifically, the error_log in /plugins/civicrm/civicrm/bin/ has this:

[12-Jun-2017 20:15:37 America/Denver] PHP Fatal error:  Uncaught Exception: Failed to locate civicrm.settings.php. Please boot with settingsFile, search, or CIVICRM_SETTINGS; or normalize your directory structure. in /path/to/mysite/wp-content/plugins/civicrm/civicrm/civicrm.config.php:125
Stack trace:
#0 /path/to/mysite/wp-content/plugins/civicrm/civicrm/civicrm.config.php(415): Civi\Cv\Bootstrap->boot()
#1 /path/to/mysite/wp-content/plugins/civicrm/civicrm/bin/cron.php(29): require_once('/path/to/...')
#2 {main}
  thrown in /path/to/mysite/wp-content/plugins/civicrm/civicrm/civicrm.config.php on line 125

Line 125 of civicrm.config.php is the throw statement here:

/**
   * Bootstrap the CiviCRM runtime.
   *
   * @param array $options
   *   See options in class doc.
   * @throws \Exception
   */
  public function boot($options = array()) {
    if (!defined('CIVICRM_SETTINGS_PATH')) {
      $this->options = $options = array_merge($this->options, $options);

      $settings = $this->getCivicrmSettingsPhp($options);
      if (empty($settings) || !file_exists($settings)) {
        throw new \Exception("Failed to locate civicrm.settings.php. Please boot with settingsFile, search, or CIVICRM_SETTINGS; or normalize your directory structure.");
      }

I am finding civicrm.settings.php in wp-content/uploads/civicrm/

Not sure how to proceed. Thanks in advance for any help!

WordPress 4.8 CiviCRM 4.7.17

2
  • You need to see what's going wrong to resolve this. I recommend you make sure you can view PHP errors (see this answer for pointers). Either find your PHP error log and watch it while triggering the error, or set display_errors to true to see errors in the browser. From there, next steps will probably be much clearer. Jun 11, 2017 at 22:13
  • Thank you @ChrisBurgess. I added some PHP error info at the end of my question. Perhaps this will give a clue to what's wrong? Jun 13, 2017 at 4:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.