ncurses (new curses) is a free software emulation of curses in System V Rel 4.0 (and above). It uses terminfo format, supports pads, colors, multiple highlights, form characters and function key mapping.
To get these functions to work, you have to compile the CGI version of PHP with --with-ncurses. That requires the ncurses library to be installed. Download the latest version from ftp://ftp.gnu.org/pub/gnu/ncurses/, compile and install it.