Module installation using drush giving error - drupal

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!

Related

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.

How to install Symfony 2.6 on Openshift?

I have tried the following guide to install symfony2 on Openshift.
But It does not work. After I visit the /url/app_dev.php, I have got a blank page (yes I removed the IP checking) with 500 error code.
I have no idea what is the problem. I did this tutorial 3 times, and still does not work. However it seems the composer installation does not work too, because I've got this message after a git push:
Could not open input file:
/var/lib/openshift/54a6c9f15973cac60f0000bd/app-root/data//composer.phar
Perhaps its a permission problem? Try chmod a+x on this file.
what you can do it via SSH log yourself into remote server using the rhc ssh command. Then got to app-deployment -> current -> repo -> php and within this directory run
"curl -sS https://getcomposer.org/installer | php"
this is how you have composer.phar within your installed app

How do I setup Drupal Console on Windows 7?

How do I install/setup Drupal Console on Windows 7? In the video by the author, the environment used is Linux.
I tried to install it on Windows 7, but I wasn't able to use it to generate a module code.
You can download the drupal console either using Git Bash
$curl https://drupalconsole.com/installer -L -o drupal
Or using windows command prompt
c:\>php -r "readfile('https://drupalconsole.com/installer');" > drupal
After downloading this file, place it beside php.exe file within your php folder (not project folder), restart your terminal/cmd-prompt and type
$drupal
to get started.
Besides downloading Drupal Console .phar file, you can also install Drupal Console using composer on windows.
First Download and install composer in your system.
Then on your windows command prompt or git terminal
$composer global require drupal/console:#stable
Create a file called drupal.bat
#php "%~dp0drupal.phar" %*
Here's the full list of steps I took:
php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar
added installation location to the global PATH
created a drupal.bat file in the same directory as drupal.phar. drupal.bat contains: #php "%~dp0drupal.phar" %*
Now you can call >drupal from any location. I would upvote #Nate's answer, but this is a new account.
Open Git bash (or any terminal with curl capability)
Run curl https://drupalconsole.com/installer -L -o drupal.phar
Create file drupal.bat with content #php "%~dp0drupal.phar" %*
Copy both files (drupal.phar and drupal.bat) into C:\WINDOWS
Open new Command prompt window then try typing drupal list.
This steps assume:
Your PHP is on Path environment variables and you can run php --version.
You have Git for Windows installed.
you can install drupal console using composer
open the command line on windows then go to :
cd /path/to/drupal8.dev
now you can install drupal console :
composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
after that you installed drupal console you can use it from drupal root directory where composer.json exist as follow:
vendor/bin/drupal <the_command>
you should replace <the_command> with one of the drupal console commands. you can see complete list of the commands here: drupal console commands
Find a php.exe
Add this path to the environnement variable path
from terminal run
php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar
i then use php-storm IDE :
file/settings/command line
add tool based on symfony console
fill php path and drupal.phar path
console is now set
tools/run command
drupal list
if you have php and composer all setup
make sure you're in your drupal root folder..open powershell (anyother cli) and do '
composer require drupal/console
'after this add.
'C:\<path to your drupalwebsite root folder>\vendor\bin'
to your paths Environment variables
and you have composer installed: Remember to install and add composer to path variables for every local drupal installation.

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

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

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