5

I am using ubuntu 21.04 in that i installed composer by using this command sudo apt-get install composer ,after installing i type composer it's showing following error

HP Fatal error:  Uncaught Error: Call to undefined function Symfony\Component\Console\Helper\mb_detect_encoding() in /usr/share/php/Symfony/Component/Console/Helper/Helper.php:50
Stack trace:
#0 /usr/share/php/Symfony/Component/Console/Descriptor/TextDescriptor.php(329): Symfony\Component\Console\Helper\Helper::strlen('h')
#1 /usr/share/php/Symfony/Component/Console/Descriptor/TextDescriptor.php(97): Symfony\Component\Console\Descriptor\TextDescriptor->calculateTotalWidthForOptions(Array)
#2 /usr/share/php/Symfony/Component/Console/Descriptor/TextDescriptor.php(197): Symfony\Component\Console\Descriptor\TextDescriptor->describeInputDefinition(Object(Symfony\Component\Console\Input\InputDefinition), Array)
#3 /usr/share/php/Symfony/Component/Console/Descriptor/Descriptor.php(55): Symfony\Component\Console\Descriptor\TextDescriptor->describeApplication(Object(Composer\Console\Application), Array)
#4 /usr/share/php/Symfony/Component/Console/Helper/DescriptorHelper.php(67): Symfony\Component\Console\Descriptor\Descriptor->describ in /usr/share/php/Symfony/Component/Console/Helper/Helper.php on line 50

please help me to fix this issue

yivi
  • 42,438
  • 18
  • 116
  • 138
Code cracker
  • 316
  • 1
  • 5
  • 20

3 Answers3

15

You simply enable mbstring extension it will remove the uncaught error

sudo apt-get install php7.2-mbstring
  • For php 7.4 , use ```sudo apt-get install php7.4-mbstring``` .. Similarly replace the version number in comand based on current php version installed in machine. – Jay Teli Jun 08 '22 at 18:31
2

If you're using PHP 7.4:

sudo apt-get install php7.4-mbstring
MiraTech
  • 1,108
  • 18
  • 35
0

Check phpinfo.php for ctype module information. In my case, it wasn't loaded and I didn't see the following:

ctype module loaded

I activated it in php.ini (location depends on your configuration):

;extension=curl
extension=ctype # uncomment or add this
;extension=ffi

and restart php service. You should see ctype module's block and error should go away.

Maxim Suslov
  • 4,335
  • 1
  • 35
  • 29