Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

317
Visualizações
CLI : shell can have colors, but PHP cannot output colors, displays ← left arrow instead

I have a shell that is color capable, but I cannot have a PHP script to output colors.

For instance:

$ echo -e "\e[32m Hello"

Outputs "Hello" in green as expected, but

$ php -r 'print "\e[32m Hello\n";'

prints the following in default color:

←[32m Hello

Any clue of what I should look into ?

enter image description here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It appears colored console output is not supposed to work reliably on windows as of yet (see PHP bug #72768 and the follow-up PR #2103). It worked on some combinations of windows/git shell/php, though.

So here's your options as far as I understand:

  • you may try to downgrade to working versions
  • try your luck with ansicon
  • use another terminal such as powershell or ConEmu
  • or wait for PHP 7.2 release where this issue is ought to be fixed
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda