By overkill452 on
Hello Everyone,
I had a functioning Drupal 8 site and decided to install Drupal Commerce. I followed the instructions to do so using composer. After installation, attempting to visit my homepage now redirects me to /core/install.php
Checking the error log gives me:
PHP Fatal error: Cannot redeclare config_get_config_directory() (previously declared in /home/***/public_html/****/core/includes/bootstrap.inc:179) in /home/***/public_html/****/web/core/includes/bootstrap.inc on line 192
I did a little digging online but can't seem to find any fix. Hopefully you guys can help?!
Thanks!
Comments
I am also experiencing this
I am also experiencing this error after doing a composer install.
Drupal was installed in another directory too
I'm having the same issue on an account that uses the Drupal Lightning project after running "composer update". I've looked at the folders and files and see that it downloaded Drupal again in the vendor folder. /home/account/vendor/drupal/core and /home/account/docroot/core
I've removed the vendor directory to have composer rebuild it and it downloads drupal and modules into the vendor folder again.
On your account it downloaded it to
/home/***/public_html/****/core
and
/home/***/public_html/****/web/core.
"It is a damn poor day when you don't learn something!" - Mr. Jones, teacher
composer/installers may be missing
Make sure you have
"composer/installers": "^1.2",In addition to the additional configuration in extra
These settings and the plugin composer/installers place drupal in the right places. Obviously, drupal/core should declare composer/installers as requirement. As that is not the case currently, you need to make sure for your project it is included.
As other types depend on drupal/core they don't have that need. Only the types of extensions supported in later versions of composer/installers should specify their version constraint.
Caution required
The suggestion to add appropriate installer paths is great, but the "docroot/" part of the template may vary in any specific installation. So don't just copy the suggestion to your composer.json but check what the drupal-root directory actually is. By default it's "web/"
Norbert
-- form follows function
No such thing as default
Have seen html, docroot and web or it is not used. Wouldn't call it drupal-root either. The terminology used is web-root within project-root. Where web-root is called DocumentRoot in VirtualHost for Apache. When downloading Drupal from d.o. you get a project based on drupal/legacy-project where web-root and project-root are the same location. Projects based on drupal/recommended-project have the web-root called web in the project-root.
The path you need to provide is relative to the project-root.
Composer …
Regarding this document "web" might be considered the "suggested web-root" in most Drupal installations and it might be helpful for less experienced users not to post snippets which may fail on "noobs". It's about time to make Drupal "noob-friendly".
Norbert
-- form follows function
Termino contradiction
Keep dreaming.
Hi have the exact same
Hi have the exact same problem as OP 4 years later and I am wondering what path I have to put as described here.
My Drupal installation runs inside /home/myname/drupal-installation-folder
So what do I have to put in this json file? thanks in advance.
Could you please be more specific?
Not every installation is equal, and to get helpful support, you should tell at least the versions and modules in effect.
Maybe posting your composer.json will put everything in perspective in an instant.
However, have you tried <code>composer update -W --dry-run</code> already? If there are any error messages you should post these as well.
Norbert
-- form follows function
Hi nofue
Hi nofue
Wow, thank you very much for your reply, your time and effort! Here is more information:
Any help is much appreciated!
There's a lot going on, and I
There's a lot going on, and I would be honestly concerned about the downgrades in your Composer output. But dealing with a broken 9.x installation is far beyond my capabilities. I would
(by providing the then working composer.json and renaming composer.lock to f.e. composer.lock.bak to have composer.lock recreated)
and try to get the site to D10. Dealing with an unsupported vs. 9 installation is like walking on broken glass -- it may hurt if you don't set steps carefully.
Hope this helps.
Norbert
-- form follows function
Hi nofue, thank you so much.
Hi Norbert, thank you so much.
Ah don't worry. Of course I backed everything up and I only broke my staging.
The thing is: I am already trying to upgrade to Drupal 10. But in terms of gettign to Drupal 10 I was adviced to upgrade all modules inside Drupal 9 first.
That's why I got this error int he first place.
If I may ask: What is "composer require drupal/upgrade_status "?
I am currently following this guide to migrate from 9 to 10: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-...
Upgrade Status is a Module
Upgrade Status is a Module which helps you upgrading to 10 -- highly recommended, as it knows which modules won't work with 10, so you won't try to run impossible upgrade routes (which may be the cause of the downgrades you see with composer).
I prefer this guideline for a 9 -> 10 upgrade:
https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-...
And yes, it also wants you to go to the latest version of core & modules, but I'd rather do this step by step manually when composer update -W fails. You have to find the version which worked with D9.5 and put this version number in your composer.json file, one at a time. In case trouble occurs, you have only to deal with one module, not with all the dependencies.
Norbert
-- form follows function
Thanks Norbert
Thanks Norbert
Actually I am already running Upgade Status I figured and it gives the following report:
Environment is incompatible: CKEditor (4)
Remove: 2 projects (Custom Theme Modules for Sliders and such)
Update: 4 projects
Collaborate with maintainers: 6 projects (Mailchimp, Ludwig, Simple Image Rotate)
Fix with rector: 3 projects (Custom Theme Modules)
Fix manually: 1 project (Custom Theme Module)
I don't quite unterstand this line: "You have to find the version which worked with D9.5 and put this version number in your composer.json file, one at a time. In case trouble occurs, you have only to deal with one module, not with all the dependencies. "
But I think it's because I don't understand how composer works fully.
So you are saying you don't runn all updates, but you go into the composer file and write the latest module number version module after module to see if it works?
How to apply the change once you change the composer.json file? Do you have to run cron or update.php?
First: If upgrade_status
First: If upgrade_status wants you to remove custom stuff, but you want to keep it, you may try to change dependency in the module.info.yml file. Adding <code>| 10</code> might do the trick. But save this for later, once 10 is up and running.
Regarding the line you didn't get: If I can avoid, I don't run trial and error with module versions by changing version numbers line by line. This is only the very last resort in case everything else fails.
From the report, I'd remove those six projects where the maintainers haven't released a working version yet and look for alternatives. Then I'd remove the four custom theme modules, and then run <code>composer update --dry-run</code> If this doesn't show any downgrades, I'd retry with option -W -- if there are still no downgrades shown, run the update.
Composer has plenty of smart features, one is running composer require with the option of --no-update -- the required module is put into the .json file, but nothing is installed. Using this feature allows you to deal with conflicting modules/versions. By postponing with --no-update you can work with various versions next time you issue composer update.
To put any changes in composer.json to effect, simply run composer update. But if you follow the hints from upgrade_status and the "upgrade 9 to 10" article, you should be fine soon.
All the best!
Norbert
-- form follows function
Thank you so much Norbert!
Thank you so much Norbert! Last thing: What is happening when I get errors when trying to upgrade to the latest version of a now incompatible module? So I am on Drupal 9.5 and I see that Mailchimp is incompatible.
However, I see that my installed version is 2.1.0-rc1.
The current version is 2.2.2.
So I run: composer require 'drupal/mailchimp:^2.2'
By doing that I hope to patch my old Mailchimp to the latest which hopefully is compatible with Drupal 10 and I have one less module in my incompatible list.
However, this now throws me the following error:
What is happening here?
--no-update
This is the perfect scenario for the --no-update option.
Once you're ready to upgrade, you issue the upgrade command with the --no-update command. Then you issue individual requires, also with the --no-update command. Once everything is put in place, you issue composer update and everything happens miraculously just in time. I think this is also (somewhat) explained in the "upgrade 9 to 10" article I linked before.
Norbert
-- form follows function
Perfect suggestion
Thanks for the hint, after 'composer update' my very basic 8.9.0 site collapsed and showed a blank screen with …/install.php in the uri field of the browser. Yikes. Inserting
got the site back on its feet. Thanks a ton.
Norbert
-- form follows function
It Works
Not sure how suddenly I got into this problem. The solution by nofue worked.
Technical Architect | Lead Software Engineer
Possibly due to its removal
In my opinion it should be a dependency of drupal/core. My understanding is that it was a dependency of drupal/core-recommended, but was removed. As you need it to get extensions to drupal at the right destination you need to make sure it is required in your project.
Yes this simple tip fixed my
Yes this simple tip fixed my commerce site thanks - I must admit composer has been driving me nuts and Ive spent way too much time fixing issues and finding fixes from what should be trivial updates etc...
Drupal development | SEO optimised build
Even after adding
Even after adding
Removing the vendors dir an reinstalling with composer install,
Composer is still putting drupal files in the vendors directory and im getting the error: PHP Fatal error: Cannot redeclare config_get_config_directory()
My installer paths are:
"installer-paths": {
"core": [
"type:drupal-core"
],
"modules/contrib/{$name}": [
"type:drupal-module"
],
"profiles/contrib/{$name}": [
"type:drupal-profile"
],
"themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/contrib/{$name}": [
"type:drupal-drush"
],
"modules/custom/{$name}": [
"type:drupal-custom-module"
],
"themes/custom/{$name}": [
"type:drupal-custom-theme"
],
"libraries/{$name}": [
"type:drupal-library"
]
}
Everything had been working fine before.
any suggestions?
Remove composer.lock as well as vendor
The composer.lock contains the calculated result of an install of a certain moment in time. That includes the destination specifications. Your specifications in composer.json are not recalculated by an install, you would need to update for that to happen. Obviously, when there is no composer.lock it gets created by install because version constraints need to be resolved.
Use `composer update --lock` for a limited update. It won't resolve version constraints for those already there.