Answers.Body: <p>There is no cron command in Windows. Instead, use Task Scheduler to create scheduled tasks that call wget, curl, or php.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-07T03:38:41.840Z
Answers.Text: but how do i let civicrm know that cron is running?
Answers.UserDisplayName: Jennifer Lee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-07T08:16:42.657Z
Answers.Text: Civi does not need to know that cron is running. Cron (linux) or Task Scheduler (Windows) are simply programs which are used to run commands on a schedule. For Civi, they are typically used to run the Job.execute command every 5 minutes so that Civi can perform tasks it needs to do periodically, like check for emails which have been scheduled to send at a certain time. Did you create a task in Task Scheduler to run Job.execute? Does it run the task as you scheduled it? What is the problem you're having?
Answers.UserDisplayName: BobS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-07T09:38:21.493Z
Answers.Text: Thank you, and I updated the question, please take a look
Answers.UserDisplayName: Jennifer Lee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-07T10:14:37.613Z
Answers.Text: 1. Can you access Joomla pages and the Civi pages from the browser? If not, you need to fix that before worrying about cron jobs.
  
  2. From your browser screenshot, it looks like your not passing the required parameters of username, password, and site-key. See https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/#parameters-to-pass-to-cronphp. Those same parameters must be in your civicrm-curl data file.
Answers.UserDisplayName: BobS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-07T10:25:33.543Z
Answers.Text: 1. I can access joomla and civi normally, individual and group test mail works, curl is running, but only cron is not working   2. yes, i have tried that solution but i dont know how to do it, where should i put the username password and site-key? i tried civicrm-curl file (with no extension, just a file),  but the cmd gives me errors saying they could not find the directory (please see image 2cmd and 3notepad ++)
Answers.UserDisplayName: Jennifer Lee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-07T17:28:50.370Z
Answers.Text: First, ensure Job.execute works from a browser with URL = example.org/administrator/components/com_civicrm/civicrm/bin/cron.php?name=<username>&pass=<password>&key=<site-key> .
  
   If that works, then try "curl --data @c:\your\path\to\civicrm-curl <cron-url>"
Answers.UserDisplayName: BobS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-08T08:13:17.390Z
Answers.Text: Yes all that works, but there are error like this [
  Warning: 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] i tried to change the civicrm_root but that would cause classloader to have problem in finding its directory.    PS: the administrator is duplicated, and i dont know how to fix that (and thank you for your replies :) )
Answers.UserDisplayName: Jennifer Lee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-08T15:46:13.897Z
Answers.Text: The code you quoted shows that $civicrm_root is expected to contain "/administrator" (with a slash). Does your $civicrm_root use backslashes? If so, try changing them to slashes. If that still doesn't work, you may have found a Civi bug in the Windows/Joomla combination. That combination is probably poorly tested and rarely used
Answers.UserDisplayName: BobS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-09T06:39:56.900Z
Answers.Text: Thank you so much, i change the civicrm_root slashes and they worked, but another problem spawns, [require_once(\libraries/import.legacy.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\joomla\administrator\includes\framework.php on line 15]   this time i tried to change some lines in defines.php or duplicate the joomla/libraries folder to joomla/administator, then it said [No configuration file found and no installation code available. Exiting...] could it be the JPATH_ROOT problem :(?
Answers.UserDisplayName: Jennifer Lee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-09T07:07:22.560Z
Answers.Text: Have a look at https://civicrm.stackexchange.com/questions/21178/cron-job-not-working-after-joomla-3-8-1-update/21179#21179. If that does not help, then you should post a new question on this board.
Answers.UserDisplayName: BobS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-09T07:27:56.333Z
Answers.Text: It dosen't, seems like compatibility problem again :( once again thank you so much for your help!
Answers.UserDisplayName: Jennifer Lee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-04T14:38:44.603Z
Answers.LastActivityDate: 2018-05-04T14:38:44.603Z
Answers.UserDisplayName: BobS
Body: <p>-job.execute works, cron runs when i click Execute Now<br>
  -individual and group test mail works properly<br>
  -curl is running<br>
  -joomla 3.8.7<br>
  -apache 24<br>
  -php 7.2.4<br>
  -civicrm 5.0.1<br><br></p>
  <p>Here's the problem:<br><br>
  -I could not find a solution, I know how to make a schedule job in window to run cron.php, but cron needs the CMS's username and password, so I did as Bobs suggested<br><br>
  -But there was an error saying No such file or directory<br><br>
  <a href="https://i.sstatic.net/OwGhf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OwGhf.png" alt="enter image description here" /></a><br><br>
  -Then i notice there is duplication in directory in Joomla.php, I guess this is the cause (because civicrm_root contains absolute path and defines.php has another) but i dont know how to fix it<br><br></p>
  <pre><code> /**
    * Setup the base path related constant.
    * @return mixed
    */
   public function getBasePath() {
     global $civicrm_root;
     $joomlaPath = explode('/administrator', $civicrm_root);
     $joomlaBase = $joomlaPath[0];
     return $joomlaBase;
   }
  </code></pre>
  <p><br><br>
  update:<br>
  -Did as Bobs suggest, to change civicrm.setting.php civicrm_root's directory slashes, it works! but new problem spawns<br><br>
  <code>Warning: require_once(\libraries/import.legacy.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\joomla\administrator\includes\framework.php on line 15</code></p>
  <p><code>Fatal error: require_once(): Failed opening required '\libraries/import.legacy.php' (include_path='.;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\packages;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/tecnickcom;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/phpseclib/phpseclib/phpseclib;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/pear_exception;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/auth_sasl;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/net_socket;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/net_smtp;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/validate_finance_creditcard;.;C: in C:\Apache24\htdocs\joomla\administrator\includes\framework.php on line 15</code><br><br><br></p>
  <p>i tried to change some lines in administrator/includes/defines.php or duplicate joomla/libraries to joomla/administrator, then it said<br><br>
  <code>No configuration file found and no installation code available. Exiting...</code><br><br>
  my goodness i just want this cron works, why so complicated :(</p>
  <p>Conclusion:
  -seems like compatibility problem with joomla 3.8.7 and civicrm 5.0.1, please check comments below for references</p>
  
Tags: <api><cron-job><cron><civicrm-home><directory>
Title: How to setup Cron in Civicrm- local server
ThreadText: # How to setup Cron in Civicrm- local server
  
  (Asked by: username_0 on 2018-05-04)
  
  -job.execute works, cron runs when i click Execute Now
  -individual and group test mail works properly
  -curl is running
  -joomla 3.8.7
  -apache 24
  -php 7.2.4
  -civicrm 5.0.1
  Here's the problem:
  -I could not find a solution, I know how to make a schedule job in window to run cron.php, but cron needs the CMS's username and password, so I did as Bobs suggested
  -But there was an error saying No such file or directory
  
  -Then i notice there is duplication in directory in Joomla.php, I guess this is the cause (because civicrm_root contains absolute path and defines.php has another) but i dont know how to fix it
   /**
    * Setup the base path related constant.
    * @return mixed
    */
   public function getBasePath() {
     global $civicrm_root;
     $joomlaPath = explode('/administrator', $civicrm_root);
     $joomlaBase = $joomlaPath[0];
     return $joomlaBase;
   }
  
  
  update:
  -Did as Bobs suggest, to change civicrm.setting.php civicrm_root's directory slashes, it works! but new problem spawns
  Warning: require_once(\libraries/import.legacy.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\joomla\administrator\includes\framework.php on line 15
  Fatal error: require_once(): Failed opening required '\libraries/import.legacy.php' (include_path='.;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\packages;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/tecnickcom;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/phpseclib/phpseclib/phpseclib;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/pear_exception;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/auth_sasl;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/net_socket;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/net_smtp;C:\Apache24\htdocs\joomla\administrator\components\com_civicrm\civicrm\vendor/pear/validate_finance_creditcard;.;C: in C:\Apache24\htdocs\joomla\administrator\includes\framework.php on line 15
  i tried to change some lines in administrator/includes/defines.php or duplicate joomla/libraries to joomla/administrator, then it said
  No configuration file found and no installation code available. Exiting...
  my goodness i just want this cron works, why so complicated :(
  Conclusion:
  -seems like compatibility problem with joomla 3.8.7 and civicrm 5.0.1, please check comments below for references
  
  **Tags:** api, cron-job, cron, civicrm-home, directory
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-05-04. Score: 1
  
  There is no cron command in Windows. Instead, use Task Scheduler to create scheduled tasks that call wget, curl, or php.
  
  > **Comments:**
  > **username_0**: but how do i let civicrm know that cron is running?  
  > **username_1**: Civi does not need to know that cron is running. Cron (linux) or Task Scheduler (Windows) are simply programs which are used to run commands on a schedule. For Civi, they are typically used to run the Job.execute command every 5 minutes so that Civi can perform tasks it needs to do periodically, like check for emails which have been scheduled to send at a certain time. Did you create a task in Task Scheduler to run Job.execute? Does it run the task as you scheduled it? What is the problem you're having?  
  > **username_0**: Thank you, and I updated the question, please take a look  
  > **username_1**: 1. Can you access Joomla pages and the Civi pages from the browser? If not, you need to fix that before worrying about cron jobs.  2. From your browser screenshot, it looks like your not passing the required parameters of username, password, and site-key. See https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/#parameters-to-pass-to-cronphp. Those same parameters must be in your civicrm-curl data file.  
  > **username_0**: 1. I can access joomla and civi normally, individual and group test mail works, curl is running, but only cron is not working   2. yes, i have tried that solution but i dont know how to do it, where should i put the username password and site-key? i tried civicrm-curl file (with no extension, just a file),  but the cmd gives me errors saying they could not find the directory (please see image 2cmd and 3notepad ++)  
  > **username_1**: First, ensure Job.execute works from a browser with URL = example.org/administrator/components/com_civicrm/civicrm/bin/cron.php?name=<username>&pass=<password>&key=<site-key> .   If that works, then try "curl --data @c:\your\path\to\civicrm-curl <cron-url>"  
  > **username_0**: Yes all that works, but there are error like this [ Warning: 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] i tried to change the civicrm_root but that would cause classloader to have problem in finding its directory.    PS: the administrator is duplicated, and i dont know how to fix that (and thank you for your replies :) )  
  > **username_1**: The code you quoted shows that $civicrm_root is expected to contain "/administrator" (with a slash). Does your $civicrm_root use backslashes? If so, try changing them to slashes. If that still doesn't work, you may have found a Civi bug in the Windows/Joomla combination. That combination is probably poorly tested and rarely used  
  > **username_0**: Thank you so much, i change the civicrm_root slashes and they worked, but another problem spawns, [require_once(\libraries/import.legacy.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\joomla\administrator\includes\framework.php on line 15]   this time i tried to change some lines in defines.php or duplicate the joomla/libraries folder to joomla/administator, then it said [No configuration file found and no installation code available. Exiting...] could it be the JPATH_ROOT problem :(?  
  > **username_1**: Have a look at https://civicrm.stackexchange.com/questions/21178/cron-job-not-working-after-joomla-3-8-1-update/21179#21179. If that does not help, then you should post a new question on this board.  
  > **username_0**: It dosen't, seems like compatibility problem again :( once again thank you so much for your help!  
  
  ---
  
  