install ncurses extensions on php7.0
Asked Answered
N

3

6

I try install ncurses extensions for php7.0 but I get this error

/bin/bash /tmp/pear/download/ncurses-1.0.2/libtool --mode=compile cc  -I. -I/tmp/pear/download/ncurses-1.0.2 -DPHP_ATOM_INC -I/tmp/pear/download/ncurses-1.0.2/include -I/tmp/pear/download/ncurses-1.0.2/main -I/tmp/pear/download/ncurses-1.0.2 -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/ncurses-1.0.2/ncurses.c -o ncurses.lo 
libtool: compile:  cc -I. -I/tmp/pear/download/ncurses-1.0.2 -DPHP_ATOM_INC -I/tmp/pear/download/ncurses-1.0.2/include -I/tmp/pear/download/ncurses-1.0.2/main -I/tmp/pear/download/ncurses-1.0.2 -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/ncurses-1.0.2/ncurses.c  -fPIC -DPIC -o .libs/ncurses.o
/tmp/pear/download/ncurses-1.0.2/ncurses.c:36:37: error: unknown type name ‘zend_rsrc_list_entry’
 static void ncurses_destruct_window(zend_rsrc_list_entry *rsrc TSRMLS_DC)
                                     ^
/tmp/pear/download/ncurses-1.0.2/ncurses.c:45:36: error: unknown type name ‘zend_rsrc_list_entry’
 static void ncurses_destruct_panel(zend_rsrc_list_entry *rsrc TSRMLS_DC)
                                    ^
/tmp/pear/download/ncurses-1.0.2/ncurses.c: In function ‘zm_startup_ncurses’:
/tmp/pear/download/ncurses-1.0.2/ncurses.c:247:57: error: ‘ncurses_destruct_window’ undeclared (first use in this function)
  le_ncurses_windows = zend_register_list_destructors_ex(ncurses_destruct_window, NULL, "ncurses_window", module_number);
                                                         ^
/tmp/pear/download/ncurses-1.0.2/ncurses.c:247:57: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/download/ncurses-1.0.2/ncurses.c:249:56: error: ‘ncurses_destruct_panel’ undeclared (first use in this function)
  le_ncurses_panels = zend_register_list_destructors_ex(ncurses_destruct_panel, NULL, "ncurses_panel", module_number);
                                                        ^
Makefile:194: ошибка выполнения рецепта для цели «ncurses.lo»
make: *** [ncurses.lo] Ошибка 1

ошибка выполнения рецепта для цели «ncurses.lo» is like error in process run target

Nimble answered 25/8, 2016 at 17:20 Comment(4)
https://bugs.php.net/patch-display.php?bug_id=71299&patch=ncurses-php7-support.patch&revision=latest exist patch for support ncurses, @PaulCrovellaNimble
this link no longer exists. was there ever a fix for this ?Farias
@Farias see this link bugs.php.net/… for latest version php not exist patchNimble
@Farias bugs.php.net don't work without VPN (I don't know why, may be country specific), you can download patch from gistSerialize
A
0

I know its an old post, but recently I have the same problem. I try the way that @mark-neyhart says in answer, but using the link that @Boshentz says in comment. And finally I can run ncurses with php8.3.

I followed these steps:

cd ~/
wget https://github.com/OOPS-ORG-PHP/mod_ncurses/archive/refs/heads/master.zip
unzip ~/master.zip
cd mod_ncurses-master
phpize
./configure --with-php-config=/usr/local/bin/php-config
make
make install
rm -Rf ~/master ~/channels.xml

the idea is download last master branch from git repository, unzip and follow the same steps that @mark-neyhart says in his answer. More "simply", dont need to patch library, the only is to compile it.

also, i added a new image in docker-hub, that contains this configuration(if someone needs it):

jakalagsp/php83-ncurses

Autocorrelation answered 8/2 at 23:41 Comment(2)
Thanks. Today, I install ncurses on php8.2 from pecl successfully.Nimble
make: *** [Makefile:213: ncurses_fe.lo] Error 1Undo
W
4

There is a patch which can be applied against v1.0.2 of ncurses for php to modify it for php 7. Once the patch has been applied, the extension can be built and installed.

Required packages (these are Debian package names): php-cli php-pear php-dev libncurses5-dev ncurses-doc libncursesw5-dev

All following commands assume the user is logged in as root. Packaging commands are specific to Debian. These have been tested under Debian Stretch.

apt-get install php-cli php-pear php-dev libncurses5-dev ncurses-doc libncursesw5-dev

Use pecl to get v1.0.2 of ncurses, and wget to get the patch (as ncurses.patch).

cd /root
pecl download ncurses
mkdir /root/ncurses
cd /root/ncurses
tar -xvzf /root/ncurses-1.0.2.tgz
wget "https://bugs.php.net/patch-display.php?bug_id=71299&patch=ncurses-php7-support-again.patch&revision=1474549490&download=1" -O ncurses.patch

Rename the ncurses-1.0.2 directory to ncurses-php5 because that is the name which the patch expects, and apply the patch.

mv ncurses-1.0.2 ncurses-php5
patch --strip=0 --verbose --ignore-whitespace <ncurses.patch

Build the ncurses extension. This will build the ncurses.so file in /root/ncurses/ncurses-php5/modules.

cd ncurses-php5
phpize
./configure
make

Install the ncurses extension. This will place the ncurses.so file in /usr/lib/php/20151012. This location may differ in other distributions.

make install

Make the ncurses.so extension available to php 7. These file locations may differ in other distributions.

cat <<'EndOfHereDoc' >/etc/php/7.0/mods-available/ncurses.ini
; configuration for php ncurses module
; priority=20
extension=ncurses.so
EndOfHereDoc
ln --symbolic /etc/php/7.0/mods-available/ncurses.ini /etc/php/7.0/cli/conf.d/20-ncurses.ini

Verify that ncurses is indeed available.

php -m | grep ncurses

Once everything is working, the /root/ncurses directory, /root/ncurses-1.0.2.tgz file, and /root/channels.xml file can be removed.

Wardell answered 28/11, 2017 at 22:32 Comment(2)
thanks but I need try, after recive on your message.Nimble
Worked like a boss !Samiel
T
1

I had the same problem and stumbled upon this topic. Soluthions provided here didn't work for me, but I found another solution, whitch is available here: https://github.com/OOPS-ORG-PHP/mod_ncurses It is patched and ready to compile. Just sharing with others that will struggle with this as I did.

Tonry answered 9/3, 2019 at 10:36 Comment(1)
How do you set this up exactly?Asch
A
0

I know its an old post, but recently I have the same problem. I try the way that @mark-neyhart says in answer, but using the link that @Boshentz says in comment. And finally I can run ncurses with php8.3.

I followed these steps:

cd ~/
wget https://github.com/OOPS-ORG-PHP/mod_ncurses/archive/refs/heads/master.zip
unzip ~/master.zip
cd mod_ncurses-master
phpize
./configure --with-php-config=/usr/local/bin/php-config
make
make install
rm -Rf ~/master ~/channels.xml

the idea is download last master branch from git repository, unzip and follow the same steps that @mark-neyhart says in his answer. More "simply", dont need to patch library, the only is to compile it.

also, i added a new image in docker-hub, that contains this configuration(if someone needs it):

jakalagsp/php83-ncurses

Autocorrelation answered 8/2 at 23:41 Comment(2)
Thanks. Today, I install ncurses on php8.2 from pecl successfully.Nimble
make: *** [Makefile:213: ncurses_fe.lo] Error 1Undo

© 2022 - 2024 — McMap. All rights reserved.