I'm trying to use composer. I want to run the composer -v
command, but it gives me an error. I'm using a macOS device and have already uninstalled and installed composer using Homebrew several times. Here is the log information from composer:
PHP Warning: PHP Startup: ^(text/|application/xhtml\+xml) (offset=0): unrecognised compile-time option bit(s) in Unknown on line 0
Warning: PHP Startup: ^(text/|application/xhtml\+xml) (offset=0): unrecognised compile-time option bit(s) in Unknown on line 0
PHP Fatal error: Uncaught ErrorException: preg_match_all(): Compilation failed: unrecognised compile-time option bit(s) at offset 0 in phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php:152
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'preg_match_all(...', 'phar:///usr/loc...', 152)
#1 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php(152): preg_match_all('#<(([a-z](?:[^\\...', '', NULL, 256)
#2 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php(135): Symfony\Component\Console\Formatter\OutputFormatter->formatAndWrap('', 0)
#3 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Output/Output.php(157): Symfony\Component\Console\Formatter\OutputFormatter->format('')
#4 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Output/Output.php(132): Symfony\Component\Console\Output\Output->write(Array, true, 16)
#5 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Application.php(836): Symfony\Component\Console\Output\Output->writeln('', 16)
#6 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Application.php(154): Symfony\Component\Console\Application->renderThrowable(Object(ErrorException), Object(Symfony\Component\Console\Output\StreamOutput))
#7 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Application.php(177): Symfony\Component\Console\Application->Symfony\Component\Console\{closure}(Object(ErrorException))
#8 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/src/Composer/Console/Application.php(138): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/bin/composer(88): Composer\Console\Application->run()
#10 /usr/local/Cellar/composer/2.4.1/bin/composer(29): require('phar:///usr/loc...')
#11 {main}
thrown in phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php on line 152
Fatal error: Uncaught ErrorException: preg_match_all(): Compilation failed: unrecognised compile-time option bit(s) at offset 0 in phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php:152
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'preg_match_all(...', 'phar:///usr/loc...', 152)
#1 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php(152): preg_match_all('#<(([a-z](?:[^\\...', '', NULL, 256)
#2 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php(135): Symfony\Component\Console\Formatter\OutputFormatter->formatAndWrap('', 0)
#3 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Output/Output.php(157): Symfony\Component\Console\Formatter\OutputFormatter->format('')
#4 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Output/Output.php(132): Symfony\Component\Console\Output\Output->write(Array, true, 16)
#5 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Application.php(836): Symfony\Component\Console\Output\Output->writeln('', 16)
#6 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Application.php(154): Symfony\Component\Console\Application->renderThrowable(Object(ErrorException), Object(Symfony\Component\Console\Output\StreamOutput))
#7 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Application.php(177): Symfony\Component\Console\Application->Symfony\Component\Console\{closure}(Object(ErrorException))
#8 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/src/Composer/Console/Application.php(138): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 phar:///usr/local/Cellar/composer/2.4.1/bin/composer/bin/composer(88): Composer\Console\Application->run()
#10 /usr/local/Cellar/composer/2.4.1/bin/composer(29): require('phar:///usr/loc...')
#11 {main}
thrown in phar:///usr/local/Cellar/composer/2.4.1/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php on line 152
I also can't run any PHP commands. I tried php -r 'echo "test\n";'
but it gives me the error below:
PHP Warning: PHP Startup: ^(text/|application/xhtml\+xml) (offset=0): unrecognised compile-time option bit(s) in Unknown on line 0
Warning: PHP Startup: ^(text/|application/xhtml\+xml) (offset=0): unrecognised compile-time option bit(s) in Unknown on line 0
test
I tried restarting PHP using Homebrew, but still not working.