I'm running CiviCRM 5.70.2 and Joomla! 5.0.3 w/ PHP 8.2 ... all seems to be working as expected with the only problem being the cron.

In administrator/components/com_civicrm/civicrm/bin/cron.php ...

  1. To get it to run I had to first define CIVICRM_CONFDIR

  2. Then I'm seeing errors in debug mode "Attempted to load class "JFactory" from the global namespace." ... which seems like it's not seeing Joomla's compatibility plugin or not loading the framework.

Any thoughts or suggestions?

  • Welcome to SE. I haven't tried Joomla 5 but I find the cv method works well for cron.
    – Aidan
    Mar 5 at 12:19

2 Answers 2


JFactory is deprecated in Joomla 5 and should be replaced with Factory.
I raised an issue for this: https://lab.civicrm.org/dev/joomla/-/issues/55


I can verify this is an issue, as it occurs with both running the cron jobs in cv and php in joomla 5

    $ cv api job.execute --user=cronuser cwd=/var/www/joomla

In Joomla.php line 651:
  Attempted to load class "JFactory" from the global namespace.  
  Did you forget a "use" statement?   


    php /var/www/joomla/administrator/components/com_civicrm/civicrm/bin/cli.php 
Symfony\Component\ErrorHandler\Error\ClassNotFoundError^ {#675
  #message: """
    Attempted to load class "JFactory" from the global namespace.\n
    Did you forget a "use" statement?
  #code: 0
  #file: "./administrator/components/com_civicrm/civicrm/CRM/Utils/System/Joomla.php"
  #line: 651
  trace: {
    ./administrator/components/com_civicrm/civicrm/CRM/Utils/System/Joomla.php:651 {
      CRM_Utils_System_Joomla->loadBootStrap($params = [], $loadUser = true, $throwError = true, $realPath = null, $loadDefines = true)^
      › // Set timezone for Joomla on Cron
      › $config = JFactory::getConfig();
      › $timezone = $config->get('offset');
    ./administrator/components/com_civicrm/civicrm/CRM/Utils/System.php:1533 { …}
    ./administrator/components/com_civicrm/civicrm/bin/cli.class.php:252 { …}
    ./administrator/components/com_civicrm/civicrm/bin/cli.class.php:67 { …}
    ./administrator/components/com_civicrm/civicrm/bin/cli.php:16 { …}

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.