Question

I have installed MAMP and the PHP it came with wasn't compiled with ncurses. I've tried to use port to install ncurses and it seems that it already exists on my system so now I was wondering if there was a way to get PHP to use it without having to recompile PHP --with-ncurses.

In other words: Can PHP be configured to use ncurses without the recompilation?

Was it helpful?

Solution

I'm sorry for the late answer but this can actually be done quite easily with MAMP.

I have done this on my MacBook running OS X Snow Leopard.

Your MAMP directory contains the tar file of the php source code. MAMP version 1.8.4 ships with php-5.2.11.tar located here: /Applications/MAMP/bin/php5/

  1. cd /Applications/MAMP/bin/php5/
  2. tar -xvf php-5.2.11.tar
  3. cd php-5.2.11/ext/ncurses
  4. /Applications/MAMP/bin/php5/bin/phpize
  5. ./configure --with-php-config=/Applications/MAMP/bin/php5/bin/php-config
  6. make
  7. make install

Afterwards you just need to add the ncurses.so extension to the MAMP php.ini

  1. echo "extension=ncurses.so" >> /Applications/MAMP/conf/php5/php.ini
  2. php -i | grep ncurses

This gives me:

ncurses

ncurses support => enabled

ncurses library version => 5.7

You can also do this with the PCNTL extension ;) ;)

Cheers!

OTHER TIPS

According to the manual, ncurses must be compiled in. Some extensions can be compiled as shared libraries (dll/so) and loaded dynamically, but some can't. Seems that ncurses can't.

I don't know a lot about how mac packages are structured, but isn't it a bsd/ports style installation? In that case, just find the package and configure + recompile it.

Edit: I see that mamp is a binary distribution. You're out of luck then. I would suggest that you install at least php from sources. It's very useful to be able to install new extensions etc. It's fairly straight forward to compile php, so even if you aren't completely confident with compiling stuff, you should be able to huddle through it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top