Body: <p>I have an external PHP script that tries to bootstrap Civi. When I use variables for Directories (like [cms.root]), the boostrap process gives me the following error. I have tried this with both &quot;civi_boostrap()&quot; and with the three-line method:</p>
  <pre><code>require_once $civi_path . '/civicrm.config.php';
  require_once 'CRM/Core/Config.php';
  $config = CRM_Core_Config::singleton();
  </code></pre>
  <p>I cannot use the cv method, as I'm also bootstrapping WordPress, and the cv Drupal bootstrap conflicts with the WP functions (timer_start conflicts).</p>
  <p>What's the best way to resolve this?</p>
  <p>Here is the error:</p>
  <pre><code>PHP Fatal error:  Uncaught RuntimeException: Cannot resolve path using &quot;cms.root.path&quot; in /var/www/example.org/sites/all/modules/civicrm/Civi/Core/Paths.php:140
  Stack trace:
  #0 /var/www/example.org/sites/all/modules/civicrm/Civi/Core/Paths.php(213): Civi\Core\Paths-&gt;getVariable('cms.root', 'path')
  #1 /var/www/example.org/sites/all/modules/civicrm/CRM/Core/Config/Runtime.php(122): Civi\Core\Paths-&gt;getPath('sites/all/civi_...')
  #2 /var/www/example.org/sites/all/modules/civicrm/Civi/Core/Container.php(561): CRM_Core_Config_Runtime-&gt;includeCustomPath()
  #3 /var/www/example.org/sites/all/modules/civicrm/CRM/Core/Config.php(93): Civi\Core\Container::boot(true)
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-31T14:23:58.300Z
Comments.Text: What is you Civi version? Are you trying to use Civi from drupal? Is your $civi_path set to '/var/www/example.org/sites/all/modules/civicrm'?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-31T18:05:51.753Z
Comments.Text: @PradeepNayak, Civi version is 5.35.1. I'm bootstrapping Civi from within a Drupal directory, yes. And yes, $civi_path is set to that path. Thanks.
Comments.UserDisplayName: Paul B
Tags: <bootstrap>
Title: Bootstrap Process not Working with Directory Variables?
ThreadText: # Bootstrap Process not Working with Directory Variables?
  
  (Asked by: username_0 on 2021-03-31)
  
  I have an external PHP script that tries to bootstrap Civi. When I use variables for Directories (like [cms.root]), the boostrap process gives me the following error. I have tried this with both "civi_boostrap()" and with the three-line method:
  require_once $civi_path . '/civicrm.config.php';
  require_once 'CRM/Core/Config.php';
  $config = CRM_Core_Config::singleton();
  
  I cannot use the cv method, as I'm also bootstrapping WordPress, and the cv Drupal bootstrap conflicts with the WP functions (timer_start conflicts).
  What's the best way to resolve this?
  Here is the error:
  PHP Fatal error:  Uncaught RuntimeException: Cannot resolve path using "cms.root.path" in /var/www/example.org/sites/all/modules/civicrm/Civi/Core/Paths.php:140
  Stack trace:
  #0 /var/www/example.org/sites/all/modules/civicrm/Civi/Core/Paths.php(213): Civi\Core\Paths->getVariable('cms.root', 'path')
  #1 /var/www/example.org/sites/all/modules/civicrm/CRM/Core/Config/Runtime.php(122): Civi\Core\Paths->getPath('sites/all/civi_...')
  #2 /var/www/example.org/sites/all/modules/civicrm/Civi/Core/Container.php(561): CRM_Core_Config_Runtime->includeCustomPath()
  #3 /var/www/example.org/sites/all/modules/civicrm/CRM/Core/Config.php(93): Civi\Core\Container::boot(true)
  
  **Tags:** bootstrap
  
  > **Comments:**
  > **username_1**: What is you Civi version? Are you trying to use Civi from drupal? Is your $civi_path set to '/var/www/example.org/sites/all/modules/civicrm'?  
  > **username_0**: @PradeepNayak, Civi version is 5.35.1. I'm bootstrapping Civi from within a Drupal directory, yes. And yes, $civi_path is set to that path. Thanks.  
  
  ---
  
  ## 0 answers
  
  