php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40474 Segmentation fault during install-pear-installer
Submitted: 2007-02-14 08:10 UTC Modified: 2007-03-07 18:42 UTC
From: zesigur at free dot fr Assigned:
Status: Closed Package: Compile Failure
PHP Version: 5.2.1 OS: Redhat 7.3 (2.4.29)
Private report: No CVE-ID: None
 [2007-02-14 08:10 UTC] zesigur at free dot fr
Description:
------------
Make install of php-5.2 and php-5.2.1 seems not to work on all our servers running redhat 7.3 (gcc 2.96, kernel 2.4.29). Configure goes well, make seems to work also, but we've got a segmentation fault during make install. 
Everything was OK on these systems with PHP 5.1.6 for instance.

Reproduce code:
---------------
CFLAGS="-O2 -march=i686 -funroll-loops -fomit-frame-pointer -I/usr/include/openssl/" ./configure --prefix=/usr --with-exec-dir=/usr/bin --with-apache=../ --with-config-file-path=/servers/apache/conf --enable-track-vars --disable-debug --enable-safe-mode --enable-inline-optimization --with-gd=/usr/local/gd --with-ttf --with-jpeg --with-jpeg-dir --with-png --with-mm --with-gnu-ld --with-gettext --enable-mbstring --with-curl=/usr/local/curl --with-zlib --enable-bcmath --enable-memory-limit --enable-libxml --with-libxml-dir=/usr/local/libxml2 --with-freetype-dir=/usr/local/freetype --with-mysql=/usr/include/mysql --with-imap --with-kerberos --with-imap-ssl

Actual result:
--------------
make install : 
Installing man pages:             /usr/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/lib/php/
make[1]: *** [install-pear-installer] Erreur de segmentation
make: *** [install-pear] Erreur 2


The issue seems to be with the sapi/cli/php binary, when "make install" launch this line : 
"/var/tmp/php-5.2.1/sapi/cli/php /var/tmp/php-5.2.1/pear/install-pear-nozlib.phar"
I've got a segmentation fault.

When I run /var/tmp/php-5.1.6/sapi/cli/php /var/tmp/php-5.2.1/pear/install-pear-nozlib.phar" I don't have Segmentation fault. So I think it is because of the php cli.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-14 08:28 UTC] zesigur at free dot fr
If this can Help, I've used GDB, here is the trace : 
GNU gdb Red Hat Linux (5.2-2)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) /var/tmp/apache_1.3.34/php-5.2.1/pear/install-pear-nozlib.phar
Undefined command: "".  Try "help".
(gdb) run /var/tmp/apache_1.3.34/php-5.2.1/pear/install-pear-nozlib.phar
Starting program: /var/tmp/apache_1.3.34/php-5.2.1/sapi/cli/php /var/tmp/apache_1.3.34/php-5.2.1/pear/install-pear-nozlib.phar
[New Thread 1024 (LWP 24857)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 24857)]
0x082c9e0a in _zval_ptr_dtor ()
(gdb) quit
 [2007-02-14 08:55 UTC] mike@php.net
This trace ain't useful, you need to type "bt" on the GDB prompt before you quit.
 [2007-02-14 09:00 UTC] zesigur at free dot fr
Sorry :)

(gdb) bt
#0  0x082c9e0a in _zval_ptr_dtor ()
#1  0x08686550 in ?? ()
#2  0x40007274 in _dl_lookup_symbol_internal () from /lib/ld-linux.so.2
Cannot access memory at address 0x73627573
 [2007-02-14 11:07 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2007-02-14 12:56 UTC] zesigur at free dot fr
make install was different with this version but fails too : 
make install
Installing PHP SAPI module:       apache
Installing PHP CLI binary:        /usr/bin/
Installing PHP CLI man page:      /usr/man/man1/
Installing build environment:     /usr/lib/php/build/
Installing header files:          /usr/include/php/
Installing helper programs:       /usr/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/lib/php/
--13:52:33--  http://pear.php.net/install-pear-nozlib.phar
           => `pear/install-pear-nozlib.phar'
R?solution de pear.php.net... 216.92.131.66
Connexion vers pear.php.net[216.92.131.66]:80...connect?.
requ?te HTTP transmise, en attente de la r?ponse...200 OK
Longueur: 3,551,864 [text/plain]

100%[======================================================================>] 3,551,864    165.76K/s    ETA 00:00

13:52:54 (167.66 KB/s) - ? pear/install-pear-nozlib.phar ? sauvegard? [3551864/3551864]

make[1]: *** [install-pear-installer] Erreur de segmentation
make: *** [install-pear] Erreur 2

and GDB on sapi/cli/php :

Starting program: /var/tmp/apache_1.3.34/php5.2-200702141130/sapi/cli/php /var/tmp/apache_1.3.34/php5.2-200702141130/pear/install-pear-nozlib.phar
[New Thread 1024 (LWP 17186)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 17186)]
0x082cb70a in _zval_ptr_dtor ()
(gdb) bt
#0  0x082cb70a in _zval_ptr_dtor ()
#1  0x086888a0 in ?? ()
#2  0x40007274 in _dl_lookup_symbol_internal () from /lib/ld-linux.so.2
Cannot access memory at address 0x73627573
 [2007-02-14 12:58 UTC] tony2001@php.net
It would help very much if you build PHP with --enable-debug.
 [2007-02-14 13:52 UTC] zesigur at free dot fr
It works changing --disable-debug into --enable-debug !! no more segfault with Your http://snaps.php.net/php5.2-latest.tar.gz

make install
Installing PHP SAPI module:       apache
Installing PHP CLI binary:        /usr/bin/
Installing PHP CLI man page:      /usr/man/man1/
Installing build environment:     /usr/lib/php/build/
Installing header files:          /usr/include/php/
Installing helper programs:       /usr/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/lib/php/
--14:46:56--  http://pear.php.net/install-pear-nozlib.phar
           => `pear/install-pear-nozlib.phar'
R?solution de pear.php.net... 216.92.131.66
Connexion vers pear.php.net[216.92.131.66]:80...connect?.
requ?te HTTP transmise, en attente de la r?ponse...200 OK
Longueur: 3,551,864 [text/plain]

100%[======================================================================>] 3,551,864    183.08K/s    ETA 00:00

14:47:19 (146.51 KB/s) - ? pear/install-pear-nozlib.phar ? sauvegard? [3551864/3551864]

[PEAR] Console_Getopt - already installed: 1.2.1
[PEAR] Archive_Tar    - already installed: 1.3.2
[PEAR] Structures_Graph- already installed: 1.0.2
[PEAR] PEAR           - already installed: 1.5.0
Wrote PEAR system config file at: /usr/etc/pear.conf
You may want to add: /usr/lib/php to your php.ini include_path
Installing PDO headers:          /usr/include/php/ext/pdo/

The original php-5.2.1.tar.gz does not work even with --enable-debug.. So there seems to be a problem with this release and --disable-debug, isn't it?
 [2007-02-14 14:00 UTC] tony2001@php.net
>So there seems to be a problem with this release and 
>--disable-debug, isn't it?
No, --disable-debug is just not that forgiving.
Please provide an account on this machine, I can't see any problems here - everything installs and works just fine.
 [2007-02-14 14:26 UTC] zesigur at free dot fr
They are LAN servers with no access from the outside.. But my question is : why does it work with your latest version with --enable-debug and why it does not work with original php-5.2.1? What are the differences between these versions? Is it because of the .phar?
 [2007-02-14 14:28 UTC] tony2001@php.net
>But my question is : why does it work with your latest
>version with --enable-debug and why it does not work with
>original php-5.2.1?
I said I can't reproduce it.

>What are the differences between these versions?
Run `diff -ru php-5.2.1 php5.2-200702141130` if you want to see the diff.
 [2007-02-14 14:34 UTC] zesigur at free dot fr
OK, so I will use this snapshot on these servers, that's OK. Thank you very much for your help !
 [2007-02-14 14:42 UTC] tony2001@php.net
Well, I would appreciate if you help us to find the roots of the problem.
First of all, please remove all these custom CFLAGS and see if it works without them.
Then remove --enable-inline-optimization and check it once again.
If that doesn't help, tell me. I'll show you what to do after that.
 [2007-02-14 15:25 UTC] zesigur at free dot fr
OK no problem to help you! I've tried with the original php-5.2.1 version. with that :

./configure \
--prefix=/usr \
--with-exec-dir=/usr/bin \
--with-apache=../ \
--with-config-file-path=/servers/apache/conf \
--enable-track-vars \
--enable-safe-mode \
--with-gd=/usr/local/gd \
--with-ttf \
--with-jpeg \
--with-jpeg-dir \
--with-png \
--with-mm \
--with-gnu-ld \
--with-gettext \
--enable-mbstring \
--with-curl=/usr/local/curl \
--with-zlib \
--enable-bcmath \
--enable-memory-limit \
--enable-libxml \
--with-libxml-dir=/usr/local/libxml2 \
--with-freetype-dir=/usr/local/freetype \
--with-mysql=/usr/include/mysql \
--with-imap \
--with-kerberos \
--with-imap-ssl

So, without the CFLAGS, and without --enable-inline-optimization . The problem is the same.
Installing PEAR environment:      /usr/lib/php/
make[1]: *** [install-pear-installer] Erreur de segmentation
make: *** [install-pear] Erreur 2
You can tell me what to try next..
 [2007-02-14 15:34 UTC] tony2001@php.net
No, please use the snapshot.
 [2007-02-14 16:13 UTC] zesigur at free dot fr
strange...
With the last snapshot :
without CLAGS, enable inline optimization and this : 
./configure \
--prefix=/usr \
--with-exec-dir=/usr/bin \
--with-apache=../ \
--with-config-file-path=/servers/apache/conf \
--enable-track-vars \
--enable-safe-mode \
--with-gd=/usr/local/gd \
--with-ttf \
--with-jpeg \
--with-jpeg-dir \
--with-png \
--with-mm \
--with-gnu-ld \
--with-gettext \
--enable-mbstring \
--with-curl=/usr/local/curl \
--with-zlib \
--enable-bcmath \
--enable-memory-limit \
--enable-libxml \
--with-libxml-dir=/usr/local/libxml2 \
--with-freetype-dir=/usr/local/freetype \
--with-mysql=/usr/include/mysql \
--with-imap \
--with-kerberos \
--with-imap-ssl

It fails with the same error.
If I just add : --enable-debug, it works......
make install
Installing PHP SAPI module:       apache
Installing PHP CLI binary:        /usr/bin/
Installing PHP CLI man page:      /usr/man/man1/
Installing build environment:     /usr/lib/php/build/
Installing header files:          /usr/include/php/
Installing helper programs:       /usr/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/lib/php/
--17:10:48--  http://pear.php.net/install-pear-nozlib.phar
           => `pear/install-pear-nozlib.phar'
R?solution de pear.php.net... 216.92.131.66
Connexion vers pear.php.net[216.92.131.66]:80...connect?.
requ?te HTTP transmise, en attente de la r?ponse...200 OK
Longueur: 3,551,864 [text/plain]

100%[=======================================================>] 3,551,864    191.96K/s    ETA 00:00

17:11:17 (118.68 KB/s) - ? pear/install-pear-nozlib.phar ? sauvegard? [3551864/3551864]

[PEAR] Console_Getopt - already installed: 1.2.1
[PEAR] Archive_Tar    - already installed: 1.3.2
[PEAR] Structures_Graph- already installed: 1.0.2
[PEAR] PEAR           - already installed: 1.5.0
Wrote PEAR system config file at: /usr/etc/pear.conf
You may want to add: /usr/lib/php to your php.ini include_path
Installing PDO headers:          /usr/include/php/ext/pdo/
 [2007-02-14 16:39 UTC] tony2001@php.net
Could you try to run it with valgrind and see if there are any errors?
Try this command:
USE_ZEND_ALLOC=0 valgrind --tool=memcheck ./sapi/cli/php -n -dshort_open_tag=0 -dsafe_mode=0 -dopen_basedir= -derror_reporting=E_ALL -dmemory_limit=-1 -ddetect_unicode=0 pear/install-pear-nozlib.phar -d "/usr/local/lib/php" -b "/usr/local/bin"

You should not see any errors except maybe for some OpenSSL warnings, which we obviously can't fix..
 [2007-02-14 16:47 UTC] zesigur at free dot fr
I have some Warnings but no errors : 

root : h195-114 - /var/tmp/apache_1.3.34/php5.2-200702141130> USE_ZEND_ALLOC=0 valgrind --tool=memcheck ./sapi/cli/php -n -dshort_open_tag=0 -dsafe_mode=0 -dopen_basedir= -derror_reporting=E_ALL -dmemory_limit=-1 -ddetect_unicode=0 pear/install-pear-nozlib.phar -d "/usr/local/lib/php" -b "/usr/local/bin"
==19100== Memcheck, a memory error detector.
==19100== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==19100== Using LibVEX rev 1732, a library for dynamic binary translation.
==19100== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==19100== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==19100== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==19100== For more details, rerun with: -v
==19100== 
Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 720

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 720

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 740

Warning: Invalid argument supplied for foreach() in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1207

Notice: Undefined variable: ret in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1269

Warning: Invalid argument supplied for foreach() in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1207

Notice: Undefined variable: ret in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1269

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 757

Warning: array_merge(): Argument #2 is not an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 766

Notice: Undefined index:  pearinstaller in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 777

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 720

Warning: Invalid argument supplied for foreach() in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1207

Notice: Undefined variable: ret in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1269
[PEAR] Console_Getopt: upgrade to a newer version (1.2.1 is not newer than 1.2.1)
[PEAR] Archive_Tar: upgrade to a newer version (1.3.2 is not newer than 1.3.2)
[PEAR] Structures_Graph: upgrade to a newer version (1.0.2 is not newer than 1.0.2)

[PEAR] PEAR: upgrade to a newer version (1.5.0 is not newer than 1.5.0)
==19100== 
==19100== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 65 from 2)
==19100== malloc/free: in use at exit: 4,033 bytes in 102 blocks.
==19100== malloc/free: 1,667,468 allocs, 1,667,366 frees, 1,691,171,570 bytes allocated.
==19100== For counts of detected errors, rerun with: -v
==19100== searching for pointers to 102 not-freed blocks.
==19100== checked 2,046,164 bytes.
==19100== 
==19100== LEAK SUMMARY:
==19100==    definitely lost: 0 bytes in 0 blocks.
==19100==      possibly lost: 0 bytes in 0 blocks.
==19100==    still reachable: 4,033 bytes in 102 blocks.
==19100==         suppressed: 0 bytes in 0 blocks.
==19100== Rerun with --leak-check=full to see details of leaked memory.
 [2007-02-14 16:56 UTC] tony2001@php.net
You probably need to remove the existing PEAR installation first.
 [2007-02-14 17:01 UTC] zesigur at free dot fr
Can you tell me how to uninstall pear properly?
 [2007-02-14 17:03 UTC] tony2001@php.net
Well, no idea about the "correct" way, but I guess `rm -rf /usr/local/lib/php` will do.
 [2007-02-14 17:19 UTC] zesigur at free dot fr
I've deleted the directory and rerun that :

root : h195-114 - /var/tmp/apache_1.3.34/php5.2-200702141130> rm -rf /usr/local/lib/php 
root : h195-114 - /var/tmp/apache_1.3.34/php5.2-200702141130> USE_ZEND_ALLOC=0 valgrind --tool=memcheck ./sapi/cli/php -n -dshort_open_tag=0 -dsafe_mode=0 -dopen_basedir= -derror_reporting=E_ALL -dmemory_limit=-1 -ddetect_unicode=0 pear/install-pear-nozlib.phar -d "/usr/local/lib/php" -b "/usr/local/bin"
==23326== Memcheck, a memory error detector.
==23326== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==23326== Using LibVEX rev 1732, a library for dynamic binary translation.
==23326== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==23326== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==23326== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==23326== For more details, rerun with: -v
==23326== 

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 720

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 720

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 740

Warning: Invalid argument supplied for foreach() in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1207

Notice: Undefined variable: ret in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1269

Warning: Invalid argument supplied for foreach() in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1207

Notice: Undefined variable: ret in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1269

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 757

Warning: array_merge(): Argument #2 is not an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 766

Notice: Undefined index:  pearinstaller in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 777

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 720

Warning: Invalid argument supplied for foreach() in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1207

Notice: Undefined variable: ret in phar://install-pear-nozlib.phar/PEAR/PackageFile/Generator/v1.php on line 1269

Warning: fopen(/usr/local/lib/php/.depdb): failed to open stream: No such file or directory in phar://install-pear-nozlib.phar/PEAR/DependencyDB.php on line 510

Warning: fopen(/usr/local/lib/php/.depdb): failed to open stream: No such file or directory in phar://install-pear-nozlib.phar/PEAR/DependencyDB.php on line 510

Fatal error: Cannot use object of type PEAR_Error as array in phar://install-pear-nozlib.phar/PEAR/DependencyDB.php on line 198
==23326== 
==23326== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 65 from 2)
==23326== malloc/free: in use at exit: 63,249 bytes in 502 blocks.
==23326== malloc/free: 250,636 allocs, 250,134 frees, 40,886,451 bytes allocated.
==23326== For counts of detected errors, rerun with: -v
==23326== searching for pointers to 502 not-freed blocks.
==23326== checked 2,048,056 bytes.
==23326== 
==23326== LEAK SUMMARY:
==23326==    definitely lost: 57,087 bytes in 338 blocks.
==23326==      possibly lost: 0 bytes in 0 blocks.
==23326==    still reachable: 6,162 bytes in 164 blocks.
==23326==         suppressed: 0 bytes in 0 blocks.
==23326== Rerun with --leak-check=full to see details of leaked memory.
 [2007-03-06 12:06 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2007-03-07 18:32 UTC] zesigur at free dot fr
It's OK with this snapshot! ;)

Thank you very much
 [2007-03-07 18:42 UTC] tony2001@php.net
Great news, thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 26 23:01:30 2024 UTC