I have a peculiar problem... I'm trying to simplify my module by breaking up a ton of code into classes, and I have all of the classes in a separate include file that I'm registering in my .info file with the files[] directive.

However, when I go to use these classes in my module code, PHP dies. It's like they're not being loaded. I thought they were supposed to autoload at first use since I was using files[]?


name = Module
description = Module description
package = Module Package
core = 7.x

scripts[] = my_module.js
files[] = includes/my_module.class.inc

1 Answer 1


The files listed in files[] do get autoloaded, but Drupal's registry needs to "find about" about them first. The .info files aren't parsed & processed on every page load, but rather only during specific system operations. Go to the /admin/config/development/performance page on your site and clear the cache - this will rebuild the registry and your files should then get loaded as necessary.

  • 1
    I had done this from the command line using drush site.local cc all numerous times, but changed nothing. I just disabled, uninstalled, and re-installed the module and the classes finally loaded. I'm totally confused on this one. Commented Aug 12, 2013 at 22:02
  • 2
    you MAY need to disable/re-enable (and potentially uninstall and then re-enable) your module for D7 to fully refresh everything IF you have added stuff to your .info file after initially enabling your module.
    – Jimajamma
    Commented Aug 12, 2013 at 22:25

Your Answer

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

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