Hi all
After ./daily.sh ran today I spotted that the URL http:///validate was throwing an error for dependencies - specifically
Fail: No composer available, please install composer
Fix: https://getcomposer.org/
I ran ./validate.php and it too threw an error
$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.37-16-g9459eeb
DB Schema | ?
PHP | 7.2.2-3+ubuntu16.04.1+deb.sury.org+1
MySQL | ?
RRDTool | 1.5.5
SNMP | NET-SNMP 5.7.3
====================================
[FAIL] No composer available, please install composer
[FIX] https://getcomposer.org/
So I have installed composer (globally)
root@####:~# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') {echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
root@####:~# php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
root@####~# php composer-setup.php --install-dir=/usr/bin --filename=composer
All settings correct for using Composer
Downloading...
Composer (version 1.6.3) successfully installed to: /usr/bin/composer
Use it: php /usr/bin/composer
and now ./validate.php checks out
$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS | 1.37-16-g9459eeb
DB Schema | 238
PHP | 7.2.2-3+ubuntu16.04.1+deb.sury.org+1
MySQL | 10.2.13-MariaDB-10.2.13+maria~xenial
RRDTool | 1.5.5
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.6.3
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
but http:///validate still throws the composer error… what obvious step have I missed?
2 Likes
Im seeing the same behavior with web ui validate.
@murrant
Bonus - I’m not being a doofus then 
(I’ve tried the obvious restart of apache2 with no impact)
1 Like
I had this issue the other day. Looks like the apt-get package of composer was way to old.
Try doing a composer -V
and see what version it is.
I’m on Composer version 1.6.3
Hrmm… Then Idk. Doing an apt-get remove composer fixed the validate for me. Here is a chatlog from Laf and I.
laf - Yesterday at 1:12 PM
That's a really old composer version, remove it and let validate install a new version
vinesman - Yesterday at 1:15 PM
Using apt-get? Or using the instructions from composer. FYI using ubuntu 16.04(edited)
laf - Yesterday at 1:17 PM
just run ./validate.php when you've removed the old version, it will sort it out
vinesman - Yesterday at 1:18 PM
./validate ran successfully, but now composer is gone ?
laf - Yesterday at 1:21 PM
it's ./composer.phar
if you want it globally just mv ./composer.phar /usr/bin/composer(edited)
But now that I run the validate, I get the same issue
Yes, that’s what we are talking about, it’s showing ok in the CLI but in the web ui validate its showing fail.
Same here - in fact you can see in my ./validate.php above that it’s composer version 1.6.3…
The web based validation seems to be failing on some machines. I’m not sure why and I can’t reproduce.
@murrant I’ve added a line of extra output in the Dependencies.php to see why the error is being thrown (ie. what is in the variable $composer_output for the composer version to not be found…)
public function validate(Validator $validator)
{
$composer_output = trim(shell_exec($validator->getBaseDir() . '/scripts/composer_wrapper.php --version'));
$found = preg_match('/Composer (version )?([.0-9]+)/', $composer_output, $matches);
if (!$found) {
$validator->fail("No composer available, please install composer", "https://getcomposer.org/");
**$validator->fail("Composer Output", $composer_output);**
return;
} else {
$validator->ok("Composer Version: " . $matches[2]);
}
And now I have some new potentially useful output…
[RuntimeException] The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly
Thanks that is really helpful.
Looks to be solved here - didn’t want to jump the gun on the basis of the PR above 
1 Like