Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to enable coloured messages for PHP CLI on console (Mac OS X, latest PHP/Apache from MacPorts)?

export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad

doesn't seem to be enough, all PHP CLI produced output is colourless on the console. Would be good if the result looks like on the XAMPP PHP instance. Any ideas?

share|improve this question
Huh? The $CLICOLOR and $LSCOLORS environment variables are for the ls command and has nothing at all to do with PHP. – DerfK Jul 21 '12 at 17:49
What leads you to believe that PHP supports color? What exactly are you expecting yo xolorize? – Zoredache Jul 21 '12 at 18:37
@Zoredache I'm used to get coloured output in the Symfony development that has scaffolding support on console, also tasks and TDD. It considerably improves the readability. – Ain Jul 21 '12 at 22:35

In order to get the colour on your console with PHP CLI, php5-posix module has to be installed. With MacPorts the following command does the job:

sudo port install php5-posix

Enabling colour on the console for the PHP output will hugely improve the readability in Symfony projects for instance.

share|improve this answer
Thanks - this worked perfectly. Note, port now asks you use the specific minor version php54-posix, php56-posix etc. – scipilot Nov 13 '15 at 2:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.