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
Register the new composer.json location
-
Connect to the server via SSH
-
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 thecomposer.json
file (don't specify the file itself)
-
Remove the broken instances in PHP Composer SQLite
-
Connect to the server via SSH
-
Back up the PHP Composer SQLite database:
# cp -a /usr/local/psa/var/modules/composer/composer.sqlite3{,.backup}
-
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'
-
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'