Drush. Command pm-enable needs a higher bootstrap level to run - drupal

I have started to learn Drupal on this week and I have installed the drush on my virtual machine with CenOS ( Drupal version: 7.28, Drush version: 7.0-dev). I installed drupal using drush by command: drush dl --drupal-project-rename=mysite
and downloaded some moduls by command: drush dl admin_menu ctools views ...
But when I want enable these moduls in Drupal by command: drush en -y admin_menu_toolbar ...
I have errors:
Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to[error]
run this command.
The drush command 'en admin_menu' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
I changed the code in the file /sites/default/settings.php
'host' => 'localhost', to
'host' => php_sapi_name() == 'cli' ? '127.0.0.1' : 'localhost',
but it still does not work.
Tell me please how can I fix it?
If I use command "drush si standard --db-url=mysql://user:password#localhost/db_name" database is create and drupal install. But when I try to sign in using provided username and password server answer me "404 Not found".
Pictures:
http://gyazo.com/c34c2f361d1675d6df42b909d7eded09
http://gyazo.com/a118b2e370b79103046f21e50f955b2f

Just running drush dl --drupal-project-rename=mysite will not install drupal for you. Only download the source.
Running drush si standard --db-url=mysql://user:password#localhost/db_name will install it for you.
Alternatively you can add --account-pass=somepassword to set the user 1 pass directly when installing.
Remember to change the --db-url to suit your setup.
After that is done, be sure you stand in the project when you run drush commands.

In my case it turned out that I needed to install mysql-client:
apt-get install mysql-client
I had the following situation:
drush 4, 5 and 6 worked fine for me.
drush 7+ didn't work (different errors, including that ones you're describing).
And my MySQL database was located on a separate server.
HTH,
Alexander

Related

How can I send Drush commands to Pantheon

I am trying to migrate my drupal 7 siteto drupal 8 site that resides on pantheon. For this purpose I have installed 3 migration modules as described in the docs. I have added my drush aliases in drush directory and I can see all my sites available:
I am using this drush commands to migrate my data to drupal 8 site on pantheon:
drush #pantheon.syyamtwo.dev drush migrate-upgrade --configure-only
But when I execute this I get the following error:
My drush version is: 8.3.1
I prefer using terminus, terminus drush [site-name.site-env] -- drush_command. Where site-name and site-env are your pantheon values.
Here is what that looks like for migration-tools drush commmands on a site name "foo" with an environment "bar":
terminus drush foo.bar -- ms
terminus drush foo.bar -- mim --tag=terms
Notice the use of --, this allows you to pass options to the drush command.

Drupal - drush installation on mamp server

I have a drupal project, and I am trying to install drush for mamp server. I have run:
composer global require drush/drush:dev-master
In the directory of my project, but when I am trying to run:
drush status
I get:
command not found: drush
Follow information listed in : https://www.drupal.org/node/1674222
At the very least, you definitely did not carry these two steps out correctly, which symlink the "drush" binary.
cd /usr/bin
ln -s /Users/myusername/drush/drush
Replace /Users/myusername/ with the name of the directory where you unpacked Drush.
You may need to quit and restart Terminal after completing these instructions before running any drush commands.
http://youtu.be/TCg02d4am_Q for more details
If you're still having problems, I suggest following the instructions here: https://www.drupal.org/node/1674222 and reporting back, editting your answer to reflect the new error you get, so we can actually help you figure out what step of the install you're not running successfully.

Error while updating Drupal with drush

I want to update my drupal, but when I am executing drush up there is an error:
The tb_sirate_starter directory could not be found within the profiles directory at /var/www/html/project/sites/all/modules/tb_megamenu, perhaps the project is enabled but has been deleted from disk.
I have tb_megamenu and I tried to install tb_sirate_starter but the error is not disappearing
The update might have moved files around and failed before the system table in Drupal's database was updated.
Try installing the Regsitry Rebuild project (if not installed already) and running a registry rebuild: https://www.drupal.org/project/registry_rebuild.
You can see if you already have it installed and run it by executing:
drush rr
If you do not have it installed already, go ahead an install it and follow directions on the project page to run it.
Once that is complete, run an updb and cache clearas well:
drush updb -y
drush cc all
Be sure to make a backup of your database and codebase before doing any of this (as you should have before running drush up in your original attempt and as you should before any and all upgrades).

Module installation using drush giving error

I have downloaded drush and cofigured it properly .Now I am trying to download a module "themekey" and install it to my drupal .Its downloading properly using
drush dl themekey
but when I try to install it using
drush en -y themekey
I get this error
drush en -y themekey
Command pm-enable needs a higher bootstrap level to run - you will [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'en themekey' could not be executed. [error]
A Drupal installation directory could not be found
Please help me in this , I am new in drpal drush and did not find way to solve this
Here is my drupal folder
/opt/lampp/htdocs/projects/drupal_test/
You need a working drupal installation, meaning php can be executed the mysql server can be reached. Then you have to change into the root directory of your installation - in your case:
cd /opt/lampp/htdocs/projects/drupal_test/
and execute the command:
drush en modulename -y
For debugging use
drush rq
If you tried changing localhost to 127.0.0.1 in settings and it still doesn't work, please have a look at the solution I found here:
Drush: “Command pm-enable needs a higher bootstrap level to run
When running drush you can run into this error message. In my case, the mysql command line tool provided with Mamp Pro was not available. You can easily test this by typing the command ‘mysql’ in terminal. Your output might be -bash: mysql: command not found.
To solve this, do the following in terminal:
sudo vim ~/.bash_profile
Press i
Move to the last line and append
export PATH=/Applications/MAMP/Library/bin/:$PATH
Hit escape
Type in :wq (including the colon) to write the file and quit vim.
Reload your profile by running source ~/.bash_profile.
The mysql command AND drush should now work!

Command needs a higher bootstrap level to run

I looked allover to a resolution to this but i'm just not finding it. I am trying to use drush on my MAMP platform (I have Leopard). Installation seems to have gone well, but i get errors when i try to use it.
My default shell is tcsh. I made a file .bash_profile and added the line "export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH" to it. then I changed to the bash shell and sent command: drush en views_ui.
(I get the same error from the tcsh shell)
I am at the root of the site.
sorry if this is a repeat question. please help...
bash-3.2$ drush en views_ui
Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to [error]
run this command.
The drush command 'en views_ui' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with
a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush topic docs-aliases` for
details.
* connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.
Drush was attempting to connect to:
Drupal version : 7.0
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database username : root
Database name : d7dev
Default theme : garland
Administration theme: garland
PHP configuration : /private/etc/php.ini
Drush version : 5.8
Drush configuration:
Drupal root : /Applications/mamp/htdocs/d7dev
Site path : sites/default
Modules path : sites/all/modules
Themes path : sites/all/themes
File directory path: sites/default/files
%paths : Array
So I know this is an old one, but did you try the solution at https://drupal.org/node/1428638 (the URL provided in your error message above)?
The upshot is that you should update your database 'host' value in settings.php with this:
'host' => php_sapi_name() == 'cli' ? '127.0.0.1' : 'localhost',
Worked great for me.
I was running into the same issue on my local dev (not using XAMP or MAMP). All I did was install php5-mysql and drush en worked.
For the people like me with the same issue for XAMPP how ended up here on this article somehow. The follow line of code did te trick for me. Make sure you "cd" first to you're Drupal root.
sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql /var/mysql

Resources