• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Module installation of DRUPAL 8 using Plesk composer?

Kulturmensch

Regular Pleskian
I am currently setting up a new site using DRUPAL 8 as provided as application in Plesk. To install modules of Drupal 8 a recommended procedure is to use composer i.e. using commands like composer require drupal/"wished module" in the console. I am wondering whether I can do this also with the composer coming with Plesk Obsidian? So I have three questions:
1. Do I have to install composer on my server in addition to my PLESK Obsidian installation, where composer seems to be already part of?
2. Can I use the composer coming together with PLESK Obsidian directly for installing modules in Plesk?
3. If 2nd is true how to do this?
 
Pre-requisites: subscription with physical hosting, allow SSH access for system user, install Drupal from Plesk catalog.
Login under system user by SSH
----------------------------------------------------------------
-bash-4.2$ pwd
/var/www/vhosts/d4.a10-52-31-63.qa.plesk.ru/httpdocs
-bash-4.2$ which composer
/usr/bin/composer
-bash-4.2$ rpm -qf /usr/bin/composer
plesk-service-node-utilities-18.0-2.centos.7+p18.0.20.0+t191004.1750.x86_64
-bash-4.2$ php -v
PHP 7.2.23 (cli) (built: Oct 2 2019 17:47:22) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.1, Copyright (c) 2002-2018, by ionCube Ltd.
with Zend OPcache v7.2.23, Copyright (c) 1999-2018, by Zend Technologies
-bash-4.2$ ls modules/
README.txt
-bash-4.2$
----------------------------------------------------------------

Try to install any extension, for example drupal/Token
----------------------------------------------------------------
-bash-4.2$ composer require drupal/Token
Using version ^1.5 for drupal/token
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 35 installs, 0 updates, 0 removals
- Installing ircmaxell/password-compat (v1.0.4): Downloading (100%)
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing drupal/token (1.5.0): Downloading (100%)
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
- Installing symfony/css-selector (v3.4.26): Downloading (100%)
...
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
-bash-4.2$

Looks like really installed:
-bash-4.2$ ls modules/contrib/token/
css LICENSE.txt src tests token.info.yml token.libraries.yml token.module token.routing.yml token.tokens.inc
js README.md templates token.drush.inc token.install token.links.task.yml token.pages.inc token.services.yml
-bash-4.2$
 
I am currently setting up a new site using DRUPAL 8 as provided as application in Plesk. To install modules of Drupal 8 a recommended procedure is to use composer i.e. using commands like composer require drupal/"wished module" in the console.

Hi @Kulturmensch,
Yes, Drupal provided as an application in Plesk is adopted for composer and contains composer.json.
But.. unfortunately, this "composerization" is based on old deprecated project "drupal/drupal": drupal/drupal
This composer template is now deprecated and has several disadvantages. Drupal.org recommends to use "drupal-composer/drupal-project": drupal-composer/drupal-project
This template has a better file structure and allows you to update drupal core or themes & modules using composer.

* checkout git repo to my domain: drupal-composer/drupal-project (btw, this step might be also performed using Plesk UI)
* execute "Update" in PHP Composer
* Create DB and DB user in Plesk, go to <mydomain>/web/install.php to configure Drupal in web browser.
After that my Drupal is working and I can update any components including Drupal Core using composer.
 
Yes, the Drupal application offered by Plesk is used for composer and includes composer.json.
However, this "composerization" is based on the obsolete "drupal/drupal" project: drupal/drupal
This composer template is no longer supported and has a number of drawbacks. "drupal-composer/drupal-project" is recommended by Drupal.org: drupal-composer/drupal-project

This template has a better file structure and allows you to use composer to update Drupal core, themes, and modules.



* checkout git repo to my domain: drupal-composer/drupal-project (btw, this step might be also performed using Plesk UI)

* execute "Update" in PHP Composer

* Create DB and DB user in Plesk, go to <mydoma
 
Back
Top