Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

316
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!