Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

325
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda