I recently had the task of installing the PHP PECL extension ncurses on my Ubuntu 10.04 (Desktop) machine. PECL is a repository manager for PHP extensions. Ncurses is a tool for doing all sorts of awesome command line terminal stuff, such as colors, building windows, updating part of the screen instead of the entire screen, etc.
I already had PHP5 installed, which provided the PECL and PEAR utilities. Unfortunately, phpize (which is required by PECL to install either some or all extensions) was not provided. Execute the two following commands to get PECL happy and install ncurses.
sudo apt-get install php5-dev sudo apt-get install ncurses-dev sudo apt-get install libncursesw5-dev sudo pecl install ncurses sudo nano /etc/php5/cli/php.ini # paste "extension=ncurses.so" somewhere
Once this is done you should be ready to roll with PHP ncurses! You can put the following into a file named test.php and run it to make sure it works:
nano test.php # paste contents which follow chmod u+x ./test.php ./test.php
Here is the PHP code to paste into nano (right click paste if you’re in a GUI) (once it’s in there, Ctrl+O, Enter, Ctrl+x):
#!/usr/bin/php <?php ncurses_init(); ncurses_end(); ?>
Good luck! Let me know if you have any trouble.
Latest posts by Thomas Hunter II (see all)
- Online Colorscheme Configurator for i3, i3status, dmenu - 2017-02-08
- A Holistic Approach to Microservices - 2016-12-27
- SF Node November 2016 – Node, Redis, and You! - 2016-11-09