composer: Composer 1.7.2 does not work in Ubuntu 18.04 and PHP 7.1

I have installed composer using the downloaded installer script but when trying run $ composer I get the following dependency error from PHP:

php: error while loading shared libraries: libicui18n.so.55: cannot open shared object file: No such file or directory

My PHP version is: -php -v

PHP 7.1.23-2+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 15 2018 11:37:26) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.1.23-2+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

However, php composer.phar works fine.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

The system in question mixes PHP installed from source in /usr/local and PHP 7.1 installed from PPA. Just make your system clean of previous installations and you’ll be fine. And always try to reproduce bug in clean system before you spend other people’s time to debug the issue for you.

@saidbakr if php composer.phar works but composer does not, make sure that /usr/bin/env php resolves to the same runtime than php.

The composer shebang uses /usr/bin/env php which resolves the executable based on the PATH. php might be overriden by a shell alias you have. If that’s indeed the issue, make sure that the PHP executable in your PATH is the working one.

@xabbuh I agree with you, but the installer should be able to check all of these stuff.

Error messages like “error while loading shared libraries” are not caused by Composer, but are due to a misconfigured PHP installation (i.e. PHP was configured to load a specific shared library that is not installed). This already happens before Composer is executed at all.