I have just upgraded from Joomla 3.10.8 to the latest version of Joomla 4 (it is 100% better). However some of my scripts that have run for years now no longer work. The scripts basically import files that arrive via FTP. I have a cron job that worked up until the upgrade which is this:

/usr/bin/wget -O /dev/null "https://mysite.com/run/myscript.php" > /dev/null 2>&1

When I run the script in the browser with error reporting switched on here is the result:

in /home/mysite/public_html/libraries/src/Factory.php (line 138)
*/ public static function getApplication()
       if (!self::$application)
           throw new \Exception('Failed to start application', 500);
       return self::$application;

And also this:

Factory::getApplication('site') in /home/mysite/public_html/blm/script_blm.php (line 24)
require_once JPATH_BASE . '/includes/framework.php';
require_once JPATH_BASE.DS.'administrator'.DS.'components'.DS.'com_osproperty'.DS.'classes'.DS.'xml.php';
ini_set('max_execution_time', 100);

And in the Stack trace it says:

Failed to start application

  at /home/mysite/public_html/libraries/src/Factory.php:138
  at Joomla\CMS\Factory::getApplication('site')

Would anyone know why it would suddenly stop working and what these errors actually mean?

1 Answer 1


Your code looks from the Joomla 2.5 era and is outdated. The DS constant is not used since Joomla 3:

The DS constant has been removed. If you really need it you can use DIRECTORY_SEPARATOR instead.

For information about backward compatibility issues, see the Joomla documentation site:

I recommend to rewrite your CLI script using a Joomla 4 example. Or use a Joomla 3 example that you adapt to Joomla 4, like: https://gist.github.com/renekreijveld/8823105

  • Thanks pe7er. I am not skilled for making these changes. Are you able to recommend anyone or where I could go to get the files re-written as paid custom work? There are 3 of them.
    – Malc
    Commented Apr 22, 2022 at 8:56
  • For commercial support you could try the Joomla! Service Providers directory: community.joomla.org/service-providers-directory
    – pe7er
    Commented Apr 22, 2022 at 9:09
  • Thank you for the advice and heads up on potential support. I shall work through those links you sent and also check out the directory
    – Malc
    Commented Apr 27, 2022 at 14:03

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.