Skip to main content

"pecl install" endet mit memory size exhausted

das hat zwar nichts mit der Programmierung zu tun, ist aber eine böse Stolperfalle: Um locking Probleme während eines php-Upgrades zu verhindern ignoriert pecl eine vorhandene php.ini und läuft mit einem default-Wert für memory_limit von nur 8MB.

Dadurch schlägt z.B. die Installation von dbx fehl:

[root@linux pear]# pecl install dbx
pecl/dbx can optionally use PHP extension "mysql"
pecl/dbx can optionally use PHP extension "odbc"
pecl/dbx can optionally use PHP extension "pgsql"
pecl/dbx can optionally use PHP extension "mssql"
pecl/dbx can optionally use PHP extension "fbsql"
pecl/dbx can optionally use PHP extension "oci8"
pecl/dbx can optionally use PHP extension "sybase_ct"
pecl/dbx can optionally use PHP extension "sqlite"
downloading dbx-1.1.0.tgz ...
Starting to download dbx-1.1.0.tgz (30,872 bytes)
.........done: 30,872 bytes

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 92160 bytes) in /usr/share/pear/PEAR/PackageFile/v2/Validator.php on line 171

php-devel gcc Achtung: Die Installation von PHP-Extension setzt einen installierten Compiler und das php-devel Paket voraus(wegen dem Kommando phpize):

[root@linux pear]# yum -y install php-devel gcc gcc-c++

Um diese Einschränkung zu umgehen kann das Paket auch mit pear installiert werden:

[root@linux pear]# pear install pecl/dbx
pecl/dbx can optionally use PHP extension "pgsql"
pecl/dbx can optionally use PHP extension "mssql"
pecl/dbx can optionally use PHP extension "fbsql"
pecl/dbx can optionally use PHP extension "oci8"
pecl/dbx can optionally use PHP extension "sybase_ct"
pecl/dbx can optionally use PHP extension "sqlite"
downloading dbx-1.1.0.tgz ...
Starting to download dbx-1.1.0.tgz (30,872 bytes)
.........done: 30,872 bytes
22 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20050922
Zend Extension Api No:   220051025
building in /var/tmp/pear-build-root/dbx-1.1.0
running: /tmp/pear/download/dbx-1.1.0/configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc and cc understand -c and -o together... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-redhat-linux-gnu
checking host system type... x86_64-redhat-linux-gnu
checking target system type... x86_64-redhat-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking for re2c... no
configure: WARNING: You will need re2c 0.9.11 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable dbx support... yes, shared
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating libtool
appending configuration tag "CXX" to libtool
appending configuration tag "F77" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx.c -o dbx.lo
mkdir .libs
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx.c  -fPIC -DPIC -o .libs/dbx.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx_mysql.c -o dbx_mysql.lo
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx_mysql.c  -fPIC -DPIC -o .libs/dbx_mysql.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx_odbc.c -o dbx_odbc.lo
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx_odbc.c  -fPIC -DPIC -o .libs/dbx_odbc.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx_pgsql.c -o dbx_pgsql.lo
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx_pgsql.c  -fPIC -DPIC -o .libs/dbx_pgsql.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx_mssql.c -o dbx_mssql.lo
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx_mssql.c  -fPIC -DPIC -o .libs/dbx_mssql.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx_fbsql.c -o dbx_fbsql.lo
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx_fbsql.c  -fPIC -DPIC -o .libs/dbx_fbsql.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx_oci8.c -o dbx_oci8.lo
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx_oci8.c  -fPIC -DPIC -o .libs/dbx_oci8.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx_sybasect.c -o dbx_sybasect.lo
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx_sybasect.c  -fPIC -DPIC -o .libs/dbx_sybasect.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=compile gcc  -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/download/dbx-1.1.0/dbx_sqlite.c -o dbx_sqlite.lo
 gcc -I. -I/tmp/pear/download/dbx-1.1.0 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/dbx-1.1.0/dbx_sqlite.c  -fPIC -DPIC -o .libs/dbx_sqlite.o
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=link gcc -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/download/dbx-1.1.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -o dbx.la -export-dynamic -avoid-version -prefer-pic -module -rpath /var/tmp/pear-build-root/dbx-1.1.0/modules  dbx.lo dbx_mysql.lo dbx_odbc.lo dbx_pgsql.lo dbx_mssql.lo dbx_fbsql.lo dbx_oci8.lo dbx_sybasect.lo dbx_sqlite.lo
gcc -shared  .libs/dbx.o .libs/dbx_mysql.o .libs/dbx_odbc.o .libs/dbx_pgsql.o .libs/dbx_mssql.o .libs/dbx_fbsql.o .libs/dbx_oci8.o .libs/dbx_sybasect.o .libs/dbx_sqlite.o   -Wl,-soname -Wl,dbx.so -o .libs/dbx.so
creating dbx.la
(cd .libs && rm -f dbx.la && ln -s ../dbx.la dbx.la)
/bin/sh /var/tmp/pear-build-root/dbx-1.1.0/libtool --mode=install cp ./dbx.la /var/tmp/pear-build-root/dbx-1.1.0/modules
cp ./.libs/dbx.so /var/tmp/pear-build-root/dbx-1.1.0/modules/dbx.so
cp ./.libs/dbx.lai /var/tmp/pear-build-root/dbx-1.1.0/modules/dbx.la
PATH="$PATH:/sbin" ldconfig -n /var/tmp/pear-build-root/dbx-1.1.0/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /var/tmp/pear-build-root/dbx-1.1.0/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-dbx-1.1.0" install
Installing shared extensions:     /var/tmp/pear-build-root/install-dbx-1.1.0/usr/lib64/php/modules/
running: find "/var/tmp/pear-build-root/install-dbx-1.1.0" -ls
3735577    4 drwxr-xr-x   3 root     root         4096 Sep 26 15:03 /var/tmp/pear-build-root/install-dbx-1.1.0
3735614    4 drwxr-xr-x   3 root     root         4096 Sep 26 15:03 /var/tmp/pear-build-root/install-dbx-1.1.0/usr
3735615    4 drwxr-xr-x   3 root     root         4096 Sep 26 15:03 /var/tmp/pear-build-root/install-dbx-1.1.0/usr/lib64
3735616    4 drwxr-xr-x   3 root     root         4096 Sep 26 15:03 /var/tmp/pear-build-root/install-dbx-1.1.0/usr/lib64/php
3735617    4 drwxr-xr-x   2 root     root         4096 Sep 26 15:03 /var/tmp/pear-build-root/install-dbx-1.1.0/usr/lib64/php/modules
3735613  296 -rwxr-xr-x   1 root     root       298880 Sep 26 15:03 /var/tmp/pear-build-root/install-dbx-1.1.0/usr/lib64/php/modules/dbx.so

Build process completed successfully
Installing '/usr/lib64/php/modules/dbx.so'
install ok: channel://pecl.php.net/dbx-1.1.0
Extension dbx enabled in php.ini

Die Installation packt das Kommando zum Laden der Extension in die erste Zeile der php.ini. Wer das nicht mag, legt das woanders hin, oder erstellt sich in der php.d eine Datei dbx.ini mit folgendem Inhalt (und entfernt die eingefügte Zeile wieder aus der php.ini):

# pear install pecl/dbx
extension="dbx.so"

[dbx]
; returned column names can be converted for compatibility reasons
; possible values for dbx.colnames_case are
; "unchanged" (default, if not set)
; "lowercase"
; "uppercase"
; the recommended default is either upper- or lowercase, but
; unchanged is currently set for backwards compatibility
dbx.colnames_case = "lowercase"