Answers.Body: <p>The answer to the question is that the directory should be anywhere within the website, so given a webroot of <code>/var/www/html</code> any of these should work</p>
  <pre><code>/var/www/html/administrator/components/com_civicrm/civicrm
  /var/www/html/administrator/
  /var/www/html/
  </code></pre>
  <p>The actual problem I had was unrelated and caused by <a href="https://lab.civicrm.org/dev/core/-/issues/4060" rel="nofollow noreferrer">this bug</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-08T21:01:50.673Z
Answers.LastActivityDate: 2023-01-08T21:01:50.673Z
Answers.UserDisplayName: thoni56
Body: <p>In the <a href="https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/#commands" rel="nofollow noreferrer">documentation for adding schedule jobs</a> to crontab it says</p>
  <pre><code>cv api job.execute --user=cronuser --cwd=/var/www/example.org
  </code></pre>
  <p>It does not explain which directory the <code>--cwd</code> should indicate, the webserver installation root, the Joomla CiviCRM component directory (<code>.../administrator/components/com_civicrm</code>) or the CiviCRM root (<code>.../administrator/components/com_civicrm/civicrm</code>).</p>
  <p>I've tried all three but get</p>
  <pre><code>In Factory.php line 137:
                                 
    Failed to start application  
                                 
  
  vars:show [--out OUT] [--flat [FLAT]] [--level LEVEL] [-t|--test] [-U|--user USER]
  </code></pre>
  <p>My problem might be something completely different of course, so I reported the problem <a href="https://github.com/civicrm/cv/issues/139" rel="nofollow noreferrer">here</a>.</p>
  <p>UPDATE: This was after updating to, or beyond, CiviCRM 5.56, which introduced compatibility with Joomla 4 but introduced an incompatibility with Joomla 3.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-04T16:41:21.923Z
Comments.Text: I'd like to comment that I had the same exact error message using version 5.56.0. I gave up on calling the api that way ultimately.  Instead,  first I generated a curl command in the api3 explorer by running `Job.execute`. Then I created an api key for the civicrm user https://docs.civicrm.org/sysadmin/en/latest/setup/api-keys/ using the MySQL method. Finally, I placed the generated api key and site key in the curl string and copied it into a .sh file. I run that .sh file from my server as a cron job.
Comments.UserDisplayName: Kurt Leadley
Tags: <joomla><cv>
Title: When running cv on a Joomla install, what directory should I use?
ThreadText: # When running cv on a Joomla install, what directory should I use?
  
  (Asked by: username_0 on 2022-12-15)
  
  In the documentation for adding schedule jobs to crontab it says
  cv api job.execute --user=cronuser --cwd=/var/www/example.org
  
  It does not explain which directory the --cwd should indicate, the webserver installation root, the Joomla CiviCRM component directory (.../administrator/components/com_civicrm) or the CiviCRM root (.../administrator/components/com_civicrm/civicrm).
  I've tried all three but get
  In Factory.php line 137:
                                 
    Failed to start application  
                                 
  
  vars:show [--out OUT] [--flat [FLAT]] [--level LEVEL] [-t|--test] [-U|--user USER]
  
  My problem might be something completely different of course, so I reported the problem here.
  UPDATE: This was after updating to, or beyond, CiviCRM 5.56, which introduced compatibility with Joomla 4 but introduced an incompatibility with Joomla 3.
  
  **Tags:** joomla, cv
  
  > **Comments:**
  > **username_1**: I'd like to comment that I had the same exact error message using version 5.56.0. I gave up on calling the api that way ultimately.  Instead,  first I generated a curl command in the api3 explorer by running `Job.execute`. Then I created an api key for the civicrm user https://docs.civicrm.org/sysadmin/en/latest/setup/api-keys/ using the MySQL method. Finally, I placed the generated api key and site key in the curl string and copied it into a .sh file. I run that .sh file from my server as a cron job.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-01-08. Score: 1 | Accepted answer
  
  The answer to the question is that the directory should be anywhere within the website, so given a webroot of /var/www/html any of these should work
  /var/www/html/administrator/components/com_civicrm/civicrm
  /var/www/html/administrator/
  /var/www/html/
  
  The actual problem I had was unrelated and caused by this bug.
  
  
  ---
  
  