0

I'm trying to get formatted coloured output from a command line utility presented on a php web page.

I'm using ansi2html.sh from http://www.pixelbeat.org/scripts/ansi2html.sh

It works fine if I run the same command from the command line. I am on OSX.

The command I am running is:

exec ("vendor/bin/phinx migrate -e development | ../../phinx_upgrades/ansi2html.sh 2>&1", $phinx_output, $phinx_return);

The output I get is:

../../phinx_upgrades/ansi2html.sh: line 38: gawk: command not found

So I assume its running the script, but it cant find gawk. I did brew install gawk but its already installed.

I can run gawk from command line, gawk --version gives me GNU Awk 4.1.1, API: 1.1

If I ask which gawk I get /usr/local/bin/gawk

When I echo $PATH I see /usr/local/bin as one of my paths.

Adamski
  • 3,585
  • 5
  • 42
  • 78

2 Answers2

1

I'm not familar with OSX, but i think that you have to add gawk folder to your environment variable PATH
Also, check directly on your bash if you can launch gawk, if it is work fine in your bash, so restart your Apache server

Hope that helps :)

Halayem Anis
  • 7,654
  • 2
  • 25
  • 45
1

Answer PHP exec $PATH variable missing elements should give hints for setting up the right $PATH for the php call. As a quick fix you could edit the ansi2html.sh script to reference /usr/local/bin/gawk directly

Community
  • 1
  • 1
pixelbeat
  • 30,615
  • 9
  • 51
  • 60