X

How to fix Composer not working on your cPanel/WHM server?

Composer not installing or working properly? Getting loads of error messages simply to run?

It looks something like this:

Fatal error: Uncaught Error: Call to undefined function Symfony\Polyfill\Mbstring\iconv() in phar:///opt/cpanel/composer/bin/composer/vendor/symfony/polyfill-mbstring/Mbstring.php:661
Stack trace:
#0 phar:///opt/cpanel/composer/bin/composer/vendor/symfony/polyfill-mbstring/bootstrap.php(48): Symfony\Polyfill\Mbstring\Mbstring::mb_strwidth(' [Composer\\Dow...', 'ASCII')
#1 phar:///opt/cpanel/composer/bin/composer/vendor/symfony/console/Helper/Helper.php(54): mb_strwidth(' [Composer\\Dow...', 'ASCII')
#2 phar:///opt/cpanel/composer/bin/composer/vendor/symfony/console/Application.php(654): Symfony\Component\Console\Helper\Helper::strlen(' [Composer\\Dow...')
#3 phar:///opt/cpanel/composer/bin/composer/vendor/symfony/console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(Composer\Downloader\TransportException), Object(Symfony\Component\Console\Output\StreamOutput))
#4 phar:///opt/cpanel/composer/bin/composer/src/Composer/Console/Application.php(103): Symfony\Component\Console\Applicatio in phar:///opt/cpanel/composer/bin/composer/vendor/symfony/polyfill-mbstring/Mbstring.php on line 661
[aspapp@client-192-129-227-26 www]$ composer require maltyxx/restclient

 

1. Google the error message for more info: https://stackoverflow.com/questions/40800616/call-to-undefined-function-symfony-polyfill-mbstring-iconv-strlen
2. Install missing extensions: https://cyberpersons.com/2016/10/21/install-missing-php-extensions-cpanelwhm/
3. Then try again!

Bad Joe: