3

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?

3
  • 1
    Huh? The $CLICOLOR and $LSCOLORS environment variables are for the ls command and has nothing at all to do with PHP.
    – DerfK
    Jul 21, 2012 at 17:49
  • What leads you to believe that PHP supports color? What exactly are you expecting yo xolorize?
    – Zoredache
    Jul 21, 2012 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, 2012 at 22:35

2 Answers 2

6

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.

1
  • 1
    Thanks - this worked perfectly. Note, port now asks you use the specific minor version php54-posix, php56-posix etc.
    – scipilot
    Nov 13, 2015 at 2:38
0

Using Mac Ports, on OS X (10.11.+) if you have PHP 7, you can do:

sudo port install php7-posix

Not the answer you're looking for? Browse other questions tagged .