0

Fatal error: Cannot redeclare template_preprocess_select() (previously declared in /Users/ron/Sites/provgmc.dev/core/includes/form.inc:30) in /Users/ron/sites/provgmc.dev/core/includes/form.inc on line 37

This is not an issue with code I've written or altered. I'm just trying to install a theme using the user interface. I tried Bootstrap and Zymphonies, then a simple module or two; they give the same error when trying to install them.

I am using Drupal 8.2.6, running on Mac OS X Sierra, with PHP 5.6.28. I am not using OPCache, and there are no changes from Mac OS pre-installed versions.

I've used Drupal 7 (under El Capitan) in the past, and I have never had any issues like this.

5
  • Can you try using a dev stack that is not the local machine? Like Acquia DevDesktop or MAMP or DrupalVM?
    – Kevin
    Commented Feb 27, 2017 at 22:15
  • Try uploading a fresh version of that file, downloaded from Drupal.org. Looks like your file has the function declared twice.
    – Jaypan
    Commented Feb 28, 2017 at 3:12
  • OK. I installed D8 in a folder in my Linux hosting account and it works as expected. Could it be the PHP distro on my iMac that is causing this problem? How do I proceed? I would really like to do the development of this site locally, on this iMac. Commented Feb 28, 2017 at 4:38
  • Did you re-upload the file?
    – Jaypan
    Commented Feb 28, 2017 at 8:16
  • Are you using template_preprocess_select()? Aren't you supposed to change template_ to your template name? I'm new to this system too, but just did this same thing. I dropped that function in my .theme file and it gave me the same error you got. I had to change template in the function name to my template name.
    – Robbiegod
    Commented Aug 1, 2019 at 15:45

1 Answer 1

0

Mac OS X should have any of these possible reasons:

  • Your site folder name is mixed case
  • You cd'd into your site folder name with the wrong case i.e. cd ~/sites/myproject instead of cd ~/Sites/myproject
  • Your groups are incorrect (use staff not wheel)
  • Drush is using a different version of PHP from MAMP (Check the output of php --version.)

If you get a redeclare error running drush cc all, check one of the above issues. If sudo drush cc all does not produce the error, it could be one of them. In my case, changing the case of my project from ~/Sites/MyProject to ~/Sites/myproject made the issue go away.

For more in-depth discussion, see:

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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