# Compatibility problem with Joomla 3.8.7 and Civicrm 5.0.1 that affects Cron

On my last question How to setup Cron in Civicrm- local server I found out Joomla.php is having problem. i used curl or cli to run cron both does not work, here are the errors:

initial error
require(C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\administrator\includes\defines.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\CRM\Utils\System\Joomla.php on line 559

after changing joomla.php and civicrm.settings.php civicrm_root slashes
require_once(\libraries/import.legacy.php): failed to open stream: No such file or directory in C:\joomla\administrator\includes\framework.php on line 15

applied patch Cron Job not working after Joomla 3.8.1 update
require_once(\libraries/vendor/autoload.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\joomla\administrator\includes\framework.php on line 18

just wonder if there is a solution for this.

• Just to note that for CiviCRM, both Joomla and Windows have relatively small usage so Joomla on Windows is very much a minority combination. If your intention is to help debug and improve CiviCRM in that setup, that's great - but if your interest is to use it 'for real' then you can make life easier for yourself by using a more tried and tested combination.
– Aidan
May 9 '18 at 9:18
• Expanding on Aidan's comment, if you need to use a machine that is natively running Windows, consider using a virtualization program, e.g. VirtualBox, to run Linux on top of Windows.
– BobS
May 9 '18 at 15:05
• Thank you Aidan, I'm intend to use it for real, and the pc I used is an old desktop with win7 (low budget purpose), I would consider to downgrade my Joomla to fit everything else. Thank you Bobs, but I'm not gonna use VirtualBox as it might complicate the setups and I want to keep the server simple and secure May 10 '18 at 2:04
• For an old desktop, unless you really want win7, I'd put a Linux on it (maybe Ubuntu server or Lubuntu if you want a desktop as well) and keep Joomla updated. Alternatively some of the hosting options start quite cheaply and include backups, standby servers etc
– Aidan
May 10 '18 at 8:46

I think you are still likely to run into problems on Windows as Aidan mentioned but to give yourself the best chance:

• use CiviCRM 5.1.0, which has additional changes to resolve cli.php problems on Joomla 3.8
• use cli.php not cron.php. cron.php still doesn't work in some environments

My recollection of PHP and Apache on Windows is that paths with / work fine so you don't need to replace with \ if that's what you meant when you said you changed civicrm_root slashes.

As you saw in the initial error, the path C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\administrator\includes\defines.php is incorrect. It should be looking in C:\Apache24\htdocs\joomla\administrator\includes\defines.php.

In CRM\Utils\System\Joomla.php, look in getBasePath(), around line 532, for this line:

$joomlaPath = explode('/administrator',$civicrm_root);


My guess is that the forward slash is not being matched in the Windows path so try changing it to:

$joomlaPath = explode(DIRECTORY_SEPARATOR . 'administrator',$civicrm_root);


UPDATE 22 August 2018: The above change to getBasePath() will be in CiviCRM 5.6

• Thank you Andrew your solution works! i upgrade the civicrm to 5.1.1, change the line 532 in joomla.php to"$joomlaPath = explode(DIRECTORY_SEPARATOR . 'administrator',$civicrm_root);" and go to defines.php, change the path of libraries on line 20 to "define('JPATH_LIBRARIES', 'C:\Apache24\htdocs\joomla' . DIRECTORY_SEPARATOR . 'libraries');", run with cli.php (yes cron does not work the error is "Warning : ini_set(): A session is active. You cannot change the session module's ini settings at this time") AND IT RUNS! Thank you so much again! May 17 '18 at 4:48
• Great, thanks for confirming Jennifer. The ini_set() warning is the problem that I'm aware of with cron.php. I think it's worth getting that change to Joomla.php into core. Would you be able to file a bug report in Gitlab and if possible create a pull request on Github with that change to Joomla.php. If not I'd be happy to do it. May 17 '18 at 5:40
• I don't have a account on Gitlab, you may file it if it's convenient for you May 17 '18 at 7:47