After upgrading to 4.7.2 from 4.6.11 I no longer can load any of my custom_php reports or searches. The custom folder location is not inserted into the include path

Fatal error: require_once(): Failed opening required 'CRM/Report/Form/Member/NWTAByUnit.php' (include_path='.:/home/mysite/public_html/test/sites/all/modules/civicrm:/home/mysite/public_html/test/sites/all/modules/civicrm/packages:.:/home/mysite/public_html/test/sites/all/modules/civicrm:/home/mysite/public_html/test/sites/all/modules/civicrm/packages:/home/mysite/public_html/test/sites/all/modules/civicrm/vendor/phpseclib/phpseclib/phpseclib:.:/usr/lib/php:/usr/local/lib/php:/usr/local/php56/lib/php') in /home/mysite/public_html/test/sites/all/modules/civicrm/CRM/Core/Controller.php on line 451

The location is set at /home/mysite/public_html/test/sites/all/modules/files/civicrm/custom_php

Running Drupal 7.41 and PHP 5.6. Everything else in the upgrade seemed to work fine. All custom data is available and the extensions directory is working correctly.

I've tried to set the path both via the settings files and the web interface. The web interface does accept the path as valid and sets it correctly.

  • 1
    Looks like digging through the site files that custom files were never fully implemented into the 4.7 release? On line 138 of runtime.php I found this:// FIXME if (isset($this->customPHPPathDir) && $this->customPHPPathDir) { set_include_path($this->customPHPPathDir . PATH_SEPARATOR . get_include_path()); } – Patrick Davis Feb 21 '16 at 22:42
  • However $this->customPHPPathDir doesn't exist, nor does it set the custom_tempates directory in the section above. – Patrick Davis Feb 22 '16 at 0:12
  • In testing, I manually set the two variables for the custom_php and the custom_templates in the runtime.php file and was able to run all my custom files. Are there plans to add back in the separate custom directories? This definitely should be documented somewhere that upgrading to 4.7.2 will break your custom files. I think for now I will avoid the 4.7 upgrade and stay with the LTS version. – Patrick Davis Feb 22 '16 at 0:29

This does appear to be a legitimate issue, so I've created a bug in the tracker here: https://issues.civicrm.org/jira/browse/CRM-18079

Generally it's better not to use this folder for maintainability reasons - it is better to use an extension - but since it is an advertised piece of functionality, it should work as intended!

Thanks for reporting this.

  • Thanks. Is the preferred method to do them as part of a extension? – Patrick Davis Feb 24 '16 at 1:34
  • Yes indeed, and I've updated the answer to reflect this =] – John Feb 24 '16 at 16:54
  • Thanks. I spent last night converting all mine over to a extension so this wont impact me in the future. – Patrick Davis Feb 25 '16 at 17:27
  • Is it better to use an extension for overriding core files? Doesn't this mean that there's multiple diffuse locations for functionality? What is two extensions both override the same core file? – JohnFF Apr 9 '16 at 17:36
  • I suppose it depends on the situation. I wonder if there are extensions out there that both override core files, as you mention, but I'm not sure what happens in that situation. – John Apr 11 '16 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.