brasileric
brasileric

Reputation: 1117

Selected the second PHP version, but on the command line it's still the first

I have installed 2 PHP version in my DirectAdmin environment: php5.5 (php1_release) and php7.1 (php2_release). Now I have one user set to php 7.1 with the PHP Versions Selector under Domain Setup. On the website in the browser it seems to work well, phpinfo tells me that php7.1 is running for this domain. But when I use composer from the command line it gives an error because it detects php5.5:

enter image description here

Any ideas how to solve this?

Upvotes: 0

Views: 1299

Answers (2)

Mostafa Soufi
Mostafa Soufi

Reputation: 799

In certain cases, I would rather utilize the actual path installation of Composer to avoid encountering the "composer command not found" issue.

/usr/local/php82/bin/php82 /usr/local/bin/composer install

Could be rewritten as:

/usr/local/php82/bin/php82 $(which composer) install

This alternative command utilizes the which command to locate the path of the Composer executable, allowing you to use the real Composer installation path and avoid any "command not found" problems.

Upvotes: 0

Nadeem0035
Nadeem0035

Reputation: 3957

Try compiling with the full path of the php binary - "/usr/local/php70/bin/php70" - instead of just "php". Now command will be like that.

/usr/local/php70/bin/php70 composer.phar update

Important note : PHP binary Path will be different for each server.

Upvotes: 1

Related Questions