Drush was not able to start the Drupal database - drupal

When I start drush en name_of_module in terminal i get this error
Im using mamp and 5.3.27 php version
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.34
Site URI : http://default
Database driver : mysql
Database username : root
Database name : ceo
Default theme : garland
Administration theme : garland
PHP executable : /usr/bin/php
PHP configuration :
PHP OS : Darwin
Drush version : 6.5.0
Drush configuration :
Drush alias files :
Drupal root : /Users/edinpuzic/Desktop/Projekti/CEO/cm
s
Site path : sites/default
File directory path : sites/default/files

I just copied the answer to another/similar question I answered recently. drush says in your snippet above, that it asumes the site URI http://default. I'm sure that's not correct? Drush needs some context to know where to get your installation (install folder and database). It knows the installation root, but not the URL (to select the correct sites/folder/).
You might want to use the option --rootto specify the webroot of your drupal installation. You can also specify the website URL using the option --uri, if you have a multisite installation. Look at http://docs.drush.org/en/master/usage/#options for an in-depth description.
But the best way to handle you setup is drush aliases (http://docs.drush.org/en/master/usage/#site-aliases). You define an alias #site1 etc. and this alias references the webroot and site URL (and optionally other parameters as well).

Related

Symfony 2 fatal error on cache directory

I ssh to my VPS where there is a vagrant box that runs a symfony project.
When i try to access the project i am getting the error:
`Fatal error: Uncaught RuntimeException: Failed to write cache file` and
`Fatal error: Uncaught exception 'RuntimeException' with message 'Could not create cache directory`
I have tried fixing file permissions as mentioned here: http://symfony.com/doc/current/setup/file_permissions.html
and even changed chmod to 777. But still getting same error.
I also tried everything there: symfony2 : failed to write cache directory
It just won't work. Any help would be much appreciated.
My VPS is running ubuntu 16.04 and vagrant is latest version with image ubuntu/trusty
If you are running Apache check your /etc/httpd/conf/httpd.conf file and find your entry for your website in there. Check to see what user Apache is running the site as. You'll want to make sure the directories and files that make up your Symfony app belong to that user and the group the user is in as well. If you are logged in as root and are in the your Symfony directory you can run:
chown -R user:group *
to change all the files and directories to that user and group. Note to replace user and group in the command above with the actual username and group.
If you still have troubles after you've found the user apache is running as, try removing your symfony files completely (if it is a fresh project that you haven' been working on) and rebuild it while you are superuser'd (su) as that user. You probably built your project as root or another user.

How to install symfony2 project existing in github repository to local instance

I'm having a symfony2 project in github repository. I want to install it to my local instance. I'm using Xampp on Windows 7. How can I achieve it?
Thanks!!
if your using xampp the easiest way is to use symfony build in server.
clone or download the symfony project to your xampp htdocs.
start your xampp and open the shell, (shell button on the right)
locate yourself in the root symfony dir. and type:
php app/console server:run
a local php server should start on http://localhost:8000
i recomment using this because (dev mode is loaded by default).
its faster then a VM because you dont sync files.
you can also add verbose arguments
php app/console server:run -vvv
that way you get more output info when debugging.

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

recaptcha does not exist, or could not be auto-loaded

I have a project installed on my windows , and today i need to install on a Ubuntu server. The project is saved on an svn sever. so i just use co to check out the project and update all the vendor bundles. all is ok when is get to the web/config.php:
To enhance your Symfony experience, it’s recommended that you fix the following :
Install and enable the intl extension.
Set short_open_tag to off in php.ini*.
* Changes to the php.ini file must be done in "/home/siteadm/common/php/Perso.ini".
so when i click 'go to the welcome page',i got :
AnnotationException: [Semantical Error] The annotation "#EWZ\bundle\RecaptchaBundle\Validator\Constraints\True" in property Acme\...\User::$recaptcha does not exist, or could not be auto-loaded.
in fact it works well on my locale. The userbunle usring recapchaBundle and FOSUserbundle, they all works well on my local windows machine.
i check the /vendor directory: they are 755
Windows is not case sensitive. Linux is.
Maybe you should use
#EWZ\ Bundle \RecaptchaBundle\Validator\Constraints\True
instead of
#EWZ\ bundle \RecaptchaBundle\Validator\Constraints\Tru3
?
It's very common mistake.

Resources