TransWikia.com

How can I create a recommended project in the root directory?

Drupal Answers Asked by user2574948 on December 6, 2021

My server consists only one Drupal site and therefore I would like to install it directly under D:homesitewwwroot

However this seems impossible as the new command composer create-project drupal/recommended-project:~8.8.0 mysite requires some sort of a folder name like ‘mysite’.

All I want is Drupal composer.json stuff to be installed in D:homesitewwwroot and ‘web’ folder to be installed in D:homesitewwwrootweb

Is this possible at all?

2 Answers

If wwwroot is empty you can simply run the following command from inside this directory.

composer create-project drupal/recommended-project .

The . at the end says: current directory.

Answered by leymannx on December 6, 2021

In some shared hosting platforms, you cannot change the root folder.

You have an optional "drupal/legacy-project" option that creates the legacy folder organization.

“composer create-project drupal/legacy-project wwwroot”

https://www.drupal.org/docs/develop/using-composer/starting-a-site-using-drupal-composer-project-templates

I have some websites on gandi.net (fr) shared hosting and it defaults the root folder to "subdomain.domain.tld/htdocs".

  • I run the "drupal/recommended-project" composer command
  • Rename the “web” folder to “htdocs”
  • Edit the composer.json file to replace “web/” by “htdocs/”
  • Run “composer update”

And voilá.

In the end, the “subdomain.domain.tld” folder looks like this:

  • config/sync/ (created manually, outside of the Drupal installation directory, defined in settings.php)
  • htdocs/
  • private/ (created manually, outside of the Drupal installation directory, defined in settings.php)
  • vendor/
  • composer.json
  • composer.lock

Edit: If you are unable to run the composer command in your shared hosting, do it locally on a LAMP (or Acquia Dev Desktop) and upload the compressed archive to your host.

Answered by Gonçalo Dumas on December 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP