OSX 10.5.x + PHP + pecl_newt
Geschrieben von Harald Lapp in PHP um 16:05
I always wanted to provide nice user interfaces for some of my commandline tools written in PHP, but was not able to solve one problem until recently. The big problem when writing user interfaces for commandline utilities written in PHP is: ... what library to use for actually building the user interface?
You could try to write your own library using ANSI escape sequences -- but your user interfaces would either be very limited or it would be a hell of work to write an extensive library providing more than just the basics.
You could try to get the ncurses extension to work -- i failed.
You could try to get the newt extension to work -- i failed ...
... until recently. Every once in a while i tried to dig up more information of how to get newt to work, because this is the library i would prefer over the other solutions. However, it did not compile on my system. Recently i searched again and was able to dig up a patch for newt-0.5.22.11. So, here are the steps to get things work:
Download newt 0.52.11 and extract it.
Download the patch for newt from the page above and apply it as described in the short tutorial provided on that page.
Download slang, which is required by newt. I decided to download the latest snapshot (pre2.2.3-60) and things worked just fine with it. Extract and build it -- i did not use any special flags for this.
Download popt, which is required for newt. I decided to download popt-1.16, which seems to be the latest release and can be found at the bottom of the download page. Extract and build it -- i did not use any special flags for this.
After installing slang and popt and patching newt, you should now be able to build and install newt.
Download pecl_newt, or install it using pecl install .... Don't forget to add newt.so to your php.ini.
pecl_newt provides some examples which should be executed to verify, that installation succeeded.