• 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 php composer add dependencies not working

brownbag

Basic Pleskian
I'm trying to add dependencies via php composer but it is not allowing me.
The php composer extension is installed (via plesk)

The instructions to manage php project dependencies with composer say to go to Websites & Domains -> Applications -> Manage my Applications, then click the application in the list and select 'Install Dependencies'. But instead of showing me applications that I can add as dependencies in composer, all I see is WordPress, Drupal and Joomla

composer1.png
This page tellls me to "Go to Websites & Domains > the domain that has the Composer application in its document root folder > PHP Composer, and then click Scan". So I do this, and I get this page, with no option to scan:

composer2.png

This page shows me this message: "The lock file is not up to date with the latest changes in composer.json. To get the latest dependencies, click 'Update'". But when I click update, nothing changes, and I still see the message telling me to update.

So it doesn’t seem to be working correctly. What is wrong?
 
Last edited:
Have you tried to install composer via CLI?

Have a look here

More additional information for composer with plesk you can get here
 
Have you tried to install composer via CLI?

Have a look here

More additional information for composer with plesk you can get here
I have tried that, but had some issues with the dependent components and just in case it was composer causing the problem, I thought I'd take a different tack and install it again via the extension. There are some benefits to this, if it works. I always have the 'manual' option to go back to, but I'd like to see first if I can get it working via plesk.
 
I have tried that, but had some issues with the dependent components and just in case it was composer causing the problem, I thought I'd take a different tack and install it again via the extension. There are some benefits to this, if it works. I always have the 'manual' option to go back to, but I'd like to see first if I can get it working via plesk.
I've done some more research and it seems that the composer extension doesn't install composer but just picks up each instance of composer and enables you to manage the dependencies a bit easier.
The scan process enables plesk to identify each composer.json located within httpdocs folder of current domain as a separate application. Then you manage each composer application separately by adding dependencies.
You need to install it first, which is OK as I've done that before.

I just want to install it in the best possible way.
The command to install it is :
curl -sS https://getcomposer.org/installer | /opt/plesk/php/7.3/bin/php
When I did this last time (before uninstalling and trying plesk :) ), it installed folder on the home directory of the account I was logged into (compleitweb), which presumably is because that is where I was when I ran the installation. Where should I run it from?
 
Hello,
thanks for the detailed feedback.
While using plesk the path to composer is at an 64-BIt architecture:
Code:
/usr/lib64/plesk-9.0/composer.phar

From this you can run composer to different php-versions. For example:
Composer install with php7.3:
Code:
/opt/plesk/php/7.3/bin/php /usr/lib/plesk-9.0/composer.phar install


More additional information about composer with plesk have a look here and here. At the last link have a look at the comment section, it's very revealing.

regards
 
Hello,
thanks for the detailed feedback.
While using plesk the path to composer is at an 64-BIt architecture:
Code:
/usr/lib64/plesk-9.0/composer.phar

From this you can run composer to different php-versions. For example:
Composer install with php7.3:
Code:
/opt/plesk/php/7.3/bin/php /usr/lib/plesk-9.0/composer.phar install


More additional information about composer with plesk have a look here and here. At the last link have a look at the comment section, it's very revealing.

regards

Yes, that's what I read that the path would be in /usr/lib64/plesk. And I couldn't find the lib64 folder, but I just found the file /usr/lib/plesk-9.0/composer.phar.
Before I realised that it was different in plesk, I had earlier installed composer via the command line - with the following command:
Code:
.curl -sS https://getcomposer.org/installer | /opt/plesk/php/7.3/bin/php

It works but it just installs a different version of composer. So when started down the plesk route, I uninstalled it first.

I've just attempted to install composer using your instructions and I get a message,
"Composer could not find a composer.json file in /usr/lib/plesk-9.0".

Fair enough - I need a composer.json file first, and I can just create that using vi. But where do I put this file? The composer.phar has to find it, so this is obviously important.
 
Last edited:
Hello,
i searched for a solution in my test-environment.. i was able to install composer fot different php-versions but this would not help you out.
To your error-message. Looks like the libary-file of composer is missing. In the documentory of composer is discryped how you can setup one:


The json file must be located in the path where you run the composer phar. For example:
Code:
server:/opt/plesk/php/7.1/bin$ php composer-setup.php
All settings correct for using Composer
Downloading...

Composer (version 1.10.10) successfully installed to: /opt/plesk/php/7.1/bin/composer.phar
Use it: php composer.phar

server:/opt/plesk/php/7.1/bin$ php composer.phar install
Composer could not find a composer.json file in /opt/plesk/php/7.1/bin
 
We can mark this as closed, yesterday night we fixed this issue.

The Problem was, that there were a wrongsymlink at
Code:
/usr/bin/

The link was directing to the wring php version so we've got the error
Code:
env: php: No such file or directory
However, sometimes occurs an unexpected error with some PHP modules such as composer.

We removed the smylink and replaced it with the right path from plesk
Code:
ln -s /opt/plesk/php/7.3/bin /usr/bin/php

After this we were ableto instal/run/update composer. I hopethis will help some one out who seached for an solution.
 
I got same problem. When i try install some packages it says this error:
Code:
/usr/bin/env: php: No such file or directory

OS: CentOS Linux 7.9.2009 (Core)
Product: Plesk Obsidian Version 18.0.38 Update #3
 
Link the php command:
Code:
sudo ln -s /usr/bin/php73 /usr/bin/php
or
Code:
ln -s /opt/plesk/php/7.3/bin /usr/bin/php

Depends on your system.
 
Link the php command:
Code:
sudo ln -s /usr/bin/php73 /usr/bin/php
or
Code:
ln -s /opt/plesk/php/7.3/bin /usr/bin/php

Depends on your system.
I have php 8.0.11. Am i need to change 7.3? And whre i must run this command? Can i execute on any folder?
 
I have php 8.0.11. Am i need to change 7.3? And whre i must run this command? Can i execute on any folder?
Could you please post the output of
Code:
php -v
so i can see which php version is used default on the CLI...
 
What OS are you using?
Please post the output of
Bash:
plesk version
Code:
Product version: Plesk Obsidian 18.0.39.1
     OS version: CentOS 7.9.2009 x86_64
     Build date: 2021/10/14 23:00
       Revision: abd80734589dbcc9d72ab53622ef5737a658fb43
 
Looks like you have no php-version which shipped with the OS. Install PHP 7.3 on your system:

Code:
yum install yum-utils –y
yum install epel-release –y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager ––enable remi–php73
yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql –y
php –v
 
Back
Top