OS: Mac OSX Lion
Core: D7.8
After a fresh install, (no contributed modules installed), I tested drush, all commands works perfectly.
However after I installed and enabled Views module.
Any PM commands ( dl, en, pml, etc) suddenly failed. I am getting the errors:
Fatal error: Cannot redeclare _views_theme_functions() (previously declared in /xxx/xxx/sites/all/modules/views/theme/theme.inc:20) in /xxx/xxx/sites/all/modules/views/theme/theme.inc on line 35
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Cannot redeclare _views_theme_functions() (previously declared
in
/xxx/xxx/sites/all/modules/views/theme/theme.inc:20)
in
/xxx/xxx/sites/all/modules/views/theme/theme.inc,
line 35
Any ideas? Thanks.
Comments
Comment #1
gilzero commentedJust an update of this issue: not only pm commands, also other core commands stop working, generated same errors.
Comment #2
perandre commentedMy collegue is having the same issue; I'll report back when fixed.
Comment #3
henrikakselsen commentedI'm getting a host of different errors regarding this error. Sorry for the long error messages.
I tried to disable views (via drush), and during that attempt I get
When I try to disable backup_migrate I get this huge error message:
The "General error: 2006 MySQL server has gone away" doesn't look very promising, but I've restarted Mysql and Mysql in general seems to be running fine in MAMP so I don't think this is a mysql problem (Other testsites are working as expected). Also the modules get enabled and disabled despite the error messages. (edited for clarification)
Comment #4
gilzero commentedSo u mean a restart of mysql in MAMP fixed the error?
Comment #5
henrikakselsen commentedSorry, that was unclear. No, the site in question still doesn't work after restart. I meant that mysql still works on other mamp sites (at least a test site) so the problem is not that mysql goes down.
Comment #6
Pocketpain commentedsub!
Comment #7
himerus commentedgetting this error on a ton of local installations...
subscribe.
Comment #8
dorianfm commentedSimilar issue, just loaded in a dump of the mysql database, ran drush pm-refresh.
It looks like themes.inc is being loaded twice, hence why the functions are trying to be redeclared.
This is a stack trace:
I'm very new to drupal, but it seems a bit brittle...
Comment #9
dorianfm commentedHmmm, seem to have found a temporary fix.
Open
/sites/all/modules/view/views.moduleand at the begining of
comment
by changing it to
save the files then run
then remove the comments
save
and all appears to be working again.
Hope this helps someone.
Comment #10
henrikakselsen commented#9 That seems to do the trick for me too. Thanks.
Comment #11
dgautsch commentedUnfortunately #9 didn't work for me. Any updates on this?
Comment #12
robcarrI'm getting the same problem. Thought I had inadvertently downloaded Views twice, but couldn't find a duplicate folder. #9 didn't work for me either
Comment #13
dgautsch commentedThat's the error I'm receiving. Has anyone else encountered this?
EDIT: Updated to the current dev version of views with no change.
I'm running MAMP if that makes a difference.
Comment #14
henrikakselsen commentedActually, even though I wrote #9, #9 doesn't really work for me either, as the error keeps coming back later. (And I still got the similar Backup Migrate error I described in #3
Comment #15
nlisgo commentedsubscribe
Comment #16
mowen3 commentedSubscribe
Comment #17
henrikakselsen commentedTry to use sudo with all your drush commands, this seems to no error messages for me, would be nice if other would test it too.
Comment #18
bachbach commentedhttp://drupal.org/node/1334312
got a similar error with drsuh and all my local sites, sudo works for me.
(sudo is quite annoying …)
Comment #19
moshe weitzman commentedthe paths in the error msg in #8 differ by lowercase/uppercase 'Sites'. Seems like a dupe of #644126: drush loads duplicate command files
Comment #20
dgautsch commentedI can confirm that running the commands as sudo work just fine.
Comment #21
cborgia commentedSudo worked for me too. (thank you)
Comment #22
dgautsch commentedOK update on this. Make sure your folder permissions and groups are set to the proper groups. That's why when you run sudo things work because your'e running as super user.
chgrp is the command.
If you're on a Mac make sure your folders are not in the wheel group but in the staff group.
Comment #23
mrryanjohnston commentedChanging group as described in #22 does not solve this issue for me.
Comment #24
sethfisher commentedThe problem is with MAMP using a different version of PHP than drush (or some such nonsense). I figured it out by reading some older threads related to the issue.
Bottom line, I added
export DRUSH_PHP="/Applications/MAMP/bin/php/php5.2.17/bin/php"to ~/.bash_profile and now I'm good to go. If you're running php 5.3 in MAMP, then switch php5.2.17 to php5.3.6 (or whatever version of PHP your current MAMP is running). For the change to take effect, runsource ~/.bash_profileor just log out and back into the shell.This info is in the drush README.txt, but it's not MAMP specific and you'd really have to understand the problem to know that it relates to you. So hopefully this post is of some help to others dealing with this issue.
Comment #25
kclarkson commentedI am using the Acquia Dev Desktop and need a little assistance with where to change this code.
Thanks,
Comment #26
klim_ commented#19 thanks. Typing Sites instead of sites on Terminal is ths solution for me
Comment #27
kclarkson commentedTo all using Acquia's Development Desktop:
Switching to the older version of php works and fixes the error.
to change your settings. settings -> config -> PHP 5.2.17
thanks #24
Comment #28
featherbellySee:
http://drupalcode.org/project/drush.git/blob/HEAD:/README.txt
ADDITIONAL CONFIGURATIONS FOR MAMP:
-----------------------------------
Users of MAMP will need to manually specify in their PATH which version of php
and MySQL to use in the command line interface. This is independent of the php
version selected in the MAMP application settings. Under OS X, edit (or create
if it does not already exist) a file called .bash_profile in your home folder.
To use php 5.2.x, add this line to .bash_profile:
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.2/bin:$PATH"
If you want to use php 5.3.x, add this line instead:
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH"
If you have MAMP v.1.84 or lower, this configuration will work for both version
of PHP:
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5/bin:$PATH"
If you have done this and are still getting a "no such file or directory" error
from PDO::__construct, try this:
sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
Additionally, you may need to adjust your php.ini settings before you can use
drush successfully. See CONFIGURING PHP.INI below for more details on how to
proceed.
ADDITIONAL CONFIGURATIONS FOR OTHER AMP STACKS:
-----------------------------------------------
Users of other Apache distributions such as XAMPP, or Acquia's Dev Desktop will
want to ensure that its php can be found by the command line by adding it to
the PATH variable, using the method in 3.b above. Depending on the version and
distribution of your AMP stack, PHP might reside at:
/Applications/acquia-drupal/php/bin Acquia Dev Desktop (Mac)
/Applications/xampp/xamppfiles/bin XAMP (Mac)
/opt/lampp/bin XAMPP (Windows)
Additionally, you may need to adjust your php.ini settings before you can use
drush successfully. See CONFIGURING PHP.INI below for more details on how to
proceed.
Comment #29
featherbellySee #28
Comment #30
Ken Ficara commentedThis isn't entirely due to Drush using the wrong PHP. I was getting this exact error on a MAMP setup but Drush was definitely using the right PHP:
I did have capital letters in my site directory so I changed the directory from SiteName to sitename. Then things got ineresting. I still got the error if I ran drush as myself, but if I used sudo, it worked fine. Look at this:
I don't get that at all, and it makes me wonder if this is a Drush problem, or something weird about the sorta-case-sensitive-but-not-really MacOS filesystem, which causes headaches in other ways as well (MySQL table names for instance).
Comment #31
kclarkson commented#28 Good looking. Your fix for MAMP was my issue.
If you have updated your MAMP it appears they changed the location of some files.
You need to add (php) right after the BIN:
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.3/bin:$PATH"
Comment #31.0
kclarkson commentedtypo
Comment #32
mikelaroy commentedlike #30, the letter-case was the issue for me. In my case I had
which produced the error. I changed it back to
and then no more error. Yet some drush commands still functioned, like enabling modules etc...
Comment #33
nachenko commentedFor those on Mac using MAMP who found "sudo drush" makes the trick.
The problem in my case was really really annoying, a total WTF:
In the Terminal, it's not the same to write "cd mamp" as "cd MAMP". You'll get to the same place, you'll see the same files, but somehow, it's not the same thing for your computer. My problem is, I used all lowercases. I closed Terminal, opened a new window, got to my site's folder USING PROPER CASES where needed. Afte doing that, no need to use "sudo" anymore for Drush.
A total WTF.
Comment #34
supadits commentedMy case is similar and fixed with
https://www.drupal.org/node/2026149#comment-7598337
It's about case sensitivity which OSX is ignoring case but not drush
Comment #35
santac311 commentedThis happened to me after a database restore. I resolved the issue by manually clearing the cache in the database (since I couldn't do it using Drush). You need to login to the database directly. If you don't know the username/password, it is stored in plain text in /sites/default/settings.php. Once you've logged in, run the commands below. Site came right back up.
USE [the-name-of-your-database];
TRUNCATE TABLE cache;
TRUNCATE TABLE cache_block;
TRUNCATE TABLE cache_bootstrap;
TRUNCATE TABLE cache_field;
TRUNCATE TABLE cache_filter;
TRUNCATE TABLE cache_form;
TRUNCATE TABLE cache_image;
TRUNCATE TABLE cache_menu;
TRUNCATE TABLE cache_page;
TRUNCATE TABLE cache_path;
TRUNCATE TABLE cache_token;
TRUNCATE TABLE cache_update;