I've been using Drupal for several years, but only just dipping a toe in with Drush - I've bought an ebook tutorial and working my way through. I've installed Composer, and used it to install Drush. The tutorial book specified a particular build of Drush to install (7.0.0-alpha5). I've navigated to a drupal folder and run

drush st 

to get installation info which works fine. The tutorial explains that you don't have to navigate into the drupal folder to do this, instead using

drush --root=PATH-TO-DRUPAL-SITE st

however this brings an error:

Fatal error: Call to undefined function conf_path()

Googling this error suggests this a problem with the version of Drush and to upgrade.

SO I've navigated into the .composer/vendor/drush/drush folder and run composer global update but composer says nothing to update, confirming the version as 7.0.0-alpha5 - I assume this is not the latest 7.x version, so do I need something changing in the composer.json file?

  • I don't use Composer but I can tell you that: I would just uninstall and reinstall Drush in Unix. Using composer was already removed as an official way to install Drush. – JohnDoea Dec 5 '16 at 15:23
  • See my checked ans here for installing after you delete the old version: drupal.stackexchange.com/questions/204842/… – JohnDoea Dec 5 '16 at 15:24
  • Thanks Benia will do, I'll stick with what's in my tutorial book for now so that it makes sense, then can move on to other methods once I understand how to use drush further down the line – iain-g Dec 5 '16 at 17:04

If you want to update your global installations of any package under composer, you can just do this:

composer global update

You don't need to navigate to .composer/vendor/drush/drush

However: There are a couple of things:

1) Your global composer.json file might have a version constraint.

Check out drush's packagist page: https://packagist.org/packages/drush/drush

That will show you the available release versions of drush.

Edit ~/.composer/composer.json so that the version constraint for drush/drush is higher than the one you have. Probably something like "~8".

Do composer global update.

2) It's best practice to install drush per project.

The reasons why are a little complex and might not answer the question here, so I'll just link to an article: https://pantheon.io/blog/composer-vs-drush-make-which-should-you-use

  • Thanks paul-m - editing that composer.json rather than the one inside drush/drush did the job, updated to 7.4 for now, which got rid of the error. I'll look at your suggestion on point 2 as well, just want to follow this tutorial for now so I understand it all a bit better. – iain-g Dec 5 '16 at 17:02

I would add that, depending upon your needs, composer global update may not bring you up to the version you need. I had run it, and was only getting to version 8.1.8.

For my needs, I needed 8.1.14, at minimum. Since the latest stable version was 8.1.15 as of now, I simply ran this: composer require drush/drush:8.1.15. This ran fine, and then checking by drush --version, which registered the proper version then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.