Articles in this section

New composer.json location is not listed in PHP Composer in Plesk: Could not load packages

Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux

Symptoms

  • The following error notification is shown in Plesk > Domains > example.com > PHP Composer >:

    Could not load packages: the /httpdocs/composer.json file of the example.com domain is invalid. To fix the issue, click "Edit composer.json" and correct the composer.json syntax.

  • The location of the composer.json file used by PHP Composer has been changed recently, the file was moved to a different location

  • Going to Domains > example.com > PHP Composer > Click on [change] > The folder where the new composer.json file is located is not listed

  • The composer application's status from the affected domain is shown as broken:

    # plesk ext composer --application -list 2>&1
    ID Name Domain Path Status
    1 drupal/legacy-project example.com httpdocs/composer.json Broken

Cause

Inconsistency in PHP Composer.

Resolution

Click on a section to expand

Register the new composer.json location
  1. Connect to the server via SSH

  2. Register the new location of the composer.json file:

    # plesk ext composer --application -register -domain example.com -path httpdocs/newpath

    Where:

    • example.com is the affected domain

    • httpdocs/newpath is the new location of the composer.json file (don't specify the file itself)

Remove the broken instances in PHP Composer SQLite
  1. Connect to the server via SSH

  2. Back up the PHP Composer SQLite database:

    # cp -a /usr/local/psa/var/modules/composer/composer.sqlite3{,.backup}

  3. List all Composer instances to get the ID of the one marked as Broken with:

    # sqlite3 /usr/local/psa/var/modules/composer/composer.sqlite3 'select * from Application'

     \# plesk ext composer --application -list  
     ID Name Domain Path Status  \
     **1** drupal/legacy-project example.com httpdocs/composer.json **Broken**
    

    Moved to internal because of #EXTPLESK-4427
    sqlite3 command alternative added as public step 3.

  4. Remove the records from the PHP Composer SQLite database making reference to the broken instance with the ID found in the previous step:

    # sqlite3 /usr/local/psa/var/modules/composer/composer.sqlite3 'delete from Application where id = 1'
    # sqlite3 /usr/local/psa/var/modules/composer/composer.sqlite3 'delete from Package where applicationID = 1'
    # sqlite3 /usr/local/psa/var/modules/composer/composer.sqlite3 'delete from Setting where applicationID = 1'

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.