Answers.Body: <p>I think you are still likely to run into problems on Windows as Aidan mentioned but to give yourself the best chance:</p>
  
  <ul>
  <li>use CiviCRM 5.1.0, which has additional changes to resolve cli.php problems on Joomla 3.8</li>
  <li>use cli.php not cron.php. cron.php still doesn't work in some environments</li>
  </ul>
  
  <p>My recollection of PHP and Apache on Windows is that paths with <code>/</code> work fine so you don't need to replace with <code>\</code> if that's what you meant when you said you changed civicrm_root slashes.</p>
  
  <p>As you saw in the initial error, the path <code>C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\administrator\includes\defines.php</code> is incorrect. It should be looking in <code>C:\Apache24\htdocs\joomla\administrator\includes\defines.php</code>.</p>
  
  <p>In <code>CRM\Utils\System\Joomla.php</code>, look in <code>getBasePath()</code>, around line 532, for this line:</p>
  
  <pre><code>$joomlaPath = explode('/administrator', $civicrm_root);
  </code></pre>
  
  <p>My guess is that the forward slash is not being matched in the Windows path so try changing it to:</p>
  
  <pre><code>$joomlaPath = explode(DIRECTORY_SEPARATOR . 'administrator', $civicrm_root);
  </code></pre>
  
  <hr>
  
  <p>UPDATE 22 August 2018: The above change to <code>getBasePath()</code> <a href="https://github.com/civicrm/civicrm-core/pull/12692" rel="nofollow noreferrer">will be in CiviCRM 5.6</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-17T04:48:37.103Z
Answers.Text: 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!
Answers.UserDisplayName: Jennifer Lee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-17T05:40:13.153Z
Answers.Text: 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.
Answers.UserDisplayName: Andrew Thompson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-17T07:47:52.627Z
Answers.Text: I don't have a account on Gitlab, you may file it if it's convenient for you
Answers.UserDisplayName: Jennifer Lee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-10T00:31:50.727Z
Answers.LastActivityDate: 2018-08-22T01:49:09.313Z
Answers.LastEditDate: 2018-08-22T01:49:09.313Z
Answers.UserDisplayName: Andrew Thompson
Body: <p>On my last question <a href="https://civicrm.stackexchange.com/questions/24804/how-to-setup-cron-in-civicrm-local-server">How to setup Cron in Civicrm- local server</a> I found out Joomla.php is having problem. i used curl or cli to run cron both does not work, here are the errors:<br></p>
  
  <p>initial error<br>
  <code>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</code><br></p>
  
  <p>after changing joomla.php and civicrm.settings.php civicrm_root slashes<br>
  <code>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</code></p>
  
  <p>applied patch <a href="https://civicrm.stackexchange.com/questions/21178/cron-job-not-working-after-joomla-3-8-1-update/21179#21179">Cron Job not working after Joomla 3.8.1 update</a> <br>
  <code>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</code><br><br></p>
  
  <p>just wonder if there is a solution for this.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-09T09:18:49.350Z
Comments.Text: 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.
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-09T15:05:20.600Z
Comments.Text: 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.
Comments.UserDisplayName: BobS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-10T02:04:37.070Z
Comments.Text: 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
Comments.UserDisplayName: Jennifer Lee
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-10T08:46:56.073Z
Comments.Text: 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
Comments.UserDisplayName: Aidan
Tags: <joomla><cron><civicrm.settings.php><compatiblity><version>
Title: Compatibility problem with Joomla 3.8.7 and Civicrm 5.0.1 that affects Cron
ThreadText: # Compatibility problem with Joomla 3.8.7 and Civicrm 5.0.1 that affects Cron
  
  (Asked by: username_0 on 2018-05-09)
  
  On my last question [How to setup Cron in Civicrm- local server](https://civicrm.stackexchange.com/questions/24804/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](https://civicrm.stackexchange.com/questions/21178/cron-job-not-working-after-joomla-3-8-1-update/21179#21179)   
  `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.
  
  **Tags:** joomla, cron, civicrm.settings.php, compatiblity, version
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_2**: Expanding on username_1'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.  
  > **username_0**: Thank you username_1, 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  
  > **username_1**: 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  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2018-05-10. Score: 2 | Accepted answer
  
  I think you are still likely to run into problems on Windows as username_1 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
  
  > **Comments:**
  > **username_0**: 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!  
  > **username_3**: 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.  
  > **username_0**: I don't have a account on Gitlab, you may file it if it's convenient for you  
  
  ---
  
  