Answers.Body: <p>Are you <em>certain</em> you're looking at Drupal 7? <a href="https://api.drupal.org/api/drupal/includes!module.inc/function/module_enable/7.x" rel="nofollow noreferrer"><code>module_enable()</code></a> is a core function in that version, but was removed in Drupal 8. Files like <a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ModuleInstaller.php/class/ModuleInstaller/8.2.x" rel="nofollow noreferrer"><code>core/lib/Drupal/Core/Extension/ModuleInstaller.php</code></a> also indicate a Drupal 8 codebase, not Drupal 7.</p>
  
  <p>As of April 2017, <a href="https://civicrm.stackexchange.com/questions/4414/does-civicrm-work-with-drupal-8-and-how-can-i-help">CiviCRM is not yet fully functional on Drupal 8</a>, so I'd suggest you try again with Drupal 7 if you want a working solution today, or get involved with the effort to make Drupal 8 happen (see previous link for how).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-23T05:41:52.987Z
Answers.Text: Hi, I just realized that an hour after posting... I should have done `drush dl drupal-7` instead of just `drupal`
Answers.UserDisplayName: JorgeeFG
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-23T05:20:32.470Z
Answers.LastActivityDate: 2017-04-23T05:20:32.470Z
Answers.UserDisplayName: Chris Burgess
Body: <p>I'm using Drush 8, Drupal 7 and CiviCRM 4.7.18</p>
  
  <p>The <code>civicrm.drush.inc</code> file that comes with CiviCRM (and is moved to <code>~/.drush/</code>) has a call to a function called module_enable() which is not defined anywhere.</p>
  
  <pre><code>Error: Call to undefined function module_enable() in drush_civicrm_install() (line 367 of /root/.drush/civicrm.drush.inc) #0               [error]
  phar:///usr/local/bin/drush/includes/command.inc(422): drush_civicrm_install()
  #1 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
  #2 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command()
  #3 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
  #4 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot-&gt;bootstrap_and_dispatch()
  #5 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
  #6 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
  #7 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
  #8 /usr/local/bin/drush(10): require('phar:///usr/loc...')
  #9 {main}.
  Error: Call to undefined function module_enable() in /root/.drush/civicrm.drush.inc on line 367 #0 phar:///usr/local/bin/drush/includes/command.inc(422): drush_civicrm_install()
  #1 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
  #2 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command()
  #3 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
  #4 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot-&gt;bootstrap_and_dispatch()
  #5 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
  #6 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
  #7 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
  #8 /usr/local/bin/drush(10): require('phar:///usr/loc...')
  #9 {main}
  Error: Call to undefined function module_enable() in drush_civicrm_install() (line 367 of /root/.drush/civicrm.drush.inc).
  Drush command terminated abnormally due to an unrecoverable error.      
  </code></pre>
  
  <p>Changing it to drush_module_enable ends in another error:</p>
  
  <pre><code>Drupal\Core\Extension\MissingDependencyException: Unable to install modules civicrm due to missing modules civicrm. in                     [error]
  /opt/compucorp/core/lib/Drupal/Core/Extension/ModuleInstaller.php:85
  Stack trace:
  #0 /opt/compucorp/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller-&gt;install(Array,
  true)
  #1 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(131): Drupal\Core\ProxyClass\Extension\ModuleInstaller-&gt;install(Array,
  true)
  #2 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(198): drush_module_install(Array)
  #3 /root/.drush/civicrm.drush.inc(367): drush_module_enable(Array)
  #4 phar:///usr/local/bin/drush/includes/command.inc(422): drush_civicrm_install()
  #5 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
  #6 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command()
  #7 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
  #8 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot-&gt;bootstrap_and_dispatch()
  #9 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
  #10 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
  #11 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
  #12 /usr/local/bin/drush(10): require('phar:///usr/loc...')
  #13 {main}
  </code></pre>
  
Tags: <drupal><drush>
Title: Drush civicrm-install failing with 'undefined function module_enable'
ThreadText: # Drush civicrm-install failing with 'undefined function module_enable'
  
  (Asked by: username_0 on 2017-04-23)
  
  I'm using Drush 8, Drupal 7 and CiviCRM 4.7.18
  The civicrm.drush.inc file that comes with CiviCRM (and is moved to ~/.drush/) has a call to a function called module_enable() which is not defined anywhere.
  Error: Call to undefined function module_enable() in drush_civicrm_install() (line 367 of /root/.drush/civicrm.drush.inc) #0               [error]
  phar:///usr/local/bin/drush/includes/command.inc(422): drush_civicrm_install()
  #1 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
  #2 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command()
  #3 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
  #4 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
  #5 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
  #6 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
  #7 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
  #8 /usr/local/bin/drush(10): require('phar:///usr/loc...')
  #9 {main}.
  Error: Call to undefined function module_enable() in /root/.drush/civicrm.drush.inc on line 367 #0 phar:///usr/local/bin/drush/includes/command.inc(422): drush_civicrm_install()
  #1 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
  #2 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command()
  #3 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
  #4 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
  #5 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
  #6 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
  #7 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
  #8 /usr/local/bin/drush(10): require('phar:///usr/loc...')
  #9 {main}
  Error: Call to undefined function module_enable() in drush_civicrm_install() (line 367 of /root/.drush/civicrm.drush.inc).
  Drush command terminated abnormally due to an unrecoverable error.      
  
  Changing it to drush_module_enable ends in another error:
  Drupal\Core\Extension\MissingDependencyException: Unable to install modules civicrm due to missing modules civicrm. in                     [error]
  /opt/compucorp/core/lib/Drupal/Core/Extension/ModuleInstaller.php:85
  Stack trace:
  #0 /opt/compucorp/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array,
  true)
  #1 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(131): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array,
  true)
  #2 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(198): drush_module_install(Array)
  #3 /root/.drush/civicrm.drush.inc(367): drush_module_enable(Array)
  #4 phar:///usr/local/bin/drush/includes/command.inc(422): drush_civicrm_install()
  #5 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
  #6 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command()
  #7 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
  #8 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
  #9 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
  #10 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
  #11 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
  #12 /usr/local/bin/drush(10): require('phar:///usr/loc...')
  #13 {main}
  
  **Tags:** drupal, drush
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-23. Score: 0 | Accepted answer
  
  Are you *certain* you're looking at Drupal 7? [`module_enable()`](https://api.drupal.org/api/drupal/includes!module.inc/function/module_enable/7.x) is a core function in that version, but was removed in Drupal 8. Files like [`core/lib/Drupal/Core/Extension/ModuleInstaller.php`](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ModuleInstaller.php/class/ModuleInstaller/8.2.x) also indicate a Drupal 8 codebase, not Drupal 7.
  
  As of April 2017, [CiviCRM is not yet fully functional on Drupal 8](https://civicrm.stackexchange.com/questions/4414/does-civicrm-work-with-drupal-8-and-how-can-i-help), so I'd suggest you try again with Drupal 7 if you want a working solution today, or get involved with the effort to make Drupal 8 happen (see previous link for how).
  
  > **Comments:**
  > **username_0**: Hi, I just realized that an hour after posting... I should have done `drush dl drupal-7` instead of just `drupal`  
  
  ---
  
  