CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • class loader issue when invoking a script
Pages: [1]

Author Topic: class loader issue when invoking a script  (Read 679 times)

sushil

  • I post occasionally
  • **
  • Posts: 36
  • Karma: 0
    • Art of Living
  • CiviCRM version: 3.2
  • CMS version: Drupal
  • MySQL version: 5.1
  • PHP version: 5.2
class loader issue when invoking a script
February 07, 2012, 11:07:34 am
I'm running a script which creates some participants. In production environment the script fails with the error "Cannot redeclare class CRM_Event_PseudoConstant" but it is not only related to this particular class, but many other classes like "CRM_Contact_BAO_Contact.php etc.

This only happens if the post hook is called even though the post hook is empty. If I print the class path at the beginning of post hook, the class gets modified to add the civicrm module before the custom module, which causes class loader issue.

If I comment out the call to the post hook, the script runs fine.

Thank you
Casti

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: class loader issue when invoking a script
February 07, 2012, 12:44:56 pm

r u using a php optimizer like xcache or apc? might want to disable it if so and see if that works

also please ensure that in your custom code, u r using require_once

finally check and make sure there is only one copy of the civicrm code base under your include path

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

sushil

  • I post occasionally
  • **
  • Posts: 36
  • Karma: 0
    • Art of Living
  • CiviCRM version: 3.2
  • CMS version: Drupal
  • MySQL version: 5.1
  • PHP version: 5.2
Re: class loader issue when invoking a script
February 07, 2012, 03:44:02 pm
Thanks Lobo.

I disabled apc and it didn't make a difference. The classes that are failing are called in core classes and therefore there are using require_once. The issue is that include path is getting modified when calling the post hook.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • class loader issue when invoking a script

This forum was archived on 2017-11-26.