Michal Przybylowicz
Michal Przybylowicz

Reputation: 1668

Output of PHP-CLI script in Bash are not colorized

I have a following code in script.php:

<?php
echo "\e[0;36m Be happy ;)\e[0m";
?>

It is run like this:

~$ php script.php

On my linux mint desktop the output is colorized but on the remote server machine it is not, but when I use bash there:

~$ echo -e "\e[0;36m Be happy ;)\e[0m";

I have colorized output... I have no idea what could be wrong.

Please help.

Upvotes: 0

Views: 125

Answers (1)

Wrikken
Wrikken

Reputation: 70520

Aha, found it:

\e escape (ESC or 0x1B (27) in ASCII) (since PHP 5.4.0)

< php 5.4.0. use "\033" instead of "\e"

Upvotes: 2

Related Questions