php在现有环境下编译安装zlib等扩展 发表于 2017-05-31 | 分类于 php | 本文总阅读量 次 安装的时候是在扩展包里面进行编译安装,所以对现有php环境没有影响首先进源码的的扩展包12[root@BBS no-debug-zts-20131226]# cd //usr/src/temp/lamp/php-5.6.15/ext[root@BBS ext]# cd zlib/ 用phpize提示报错Cannot find config.m4.1234567891011[root@BBS zlib]# lsconfig0.m4 CREDITS php_zlib.def tests zlib.dsp zlib_fopen_wrapper.cconfig.w32 package.xml php_zlib.h zlib.c zlib_filter.c zlib_win32_howto.txt[root@BBS zlib]# phpizeCannot find config.m4. Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module[root@BBS zlib]# /usr/local/php/bin/phpize Cannot find config.m4. Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module ls一下发现原来config名字改成了config0. cp过来一份。12345[root@BBS zlib]# ls config*config0.m4 config.w32[root@BBS zlib]# cp config0.m4 config.m4cmake -DCMAKE_INSTALL_PREFIX=/usr/local/make && make install 成功运行编译好环境12345[root@BBS zlib]# /usr/local/php/bin/phpize Configuring for:PHP Api Version: 20131106Zend Module Api No: 20131226Zend Extension Api No: 220131226 找到以前的配置文件,配置编译安装123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122[root@BBS zlib]# locate php-config/usr/local/php/bin/php-config/usr/local/php/php/man/man1/php-config.1[root@BBS zlib]# ./configure --with-php-config=/usr/local/php/bin/php-configchecking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin/grep -Echecking for a sed that does not truncate output... /bin/sedchecking for cc... ccchecking for C compiler default output file name... a.outchecking whether the C compiler works... yeschecking whether we are cross compiling... nochecking for suffix of executables... checking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether cc accepts -g... yeschecking for cc option to accept ISO C89... none neededchecking how to run the C preprocessor... cc -Echecking for icc... nochecking for suncc... nochecking whether cc understands -c and -o together... yeschecking for system library directory... libchecking if compiler supports -R... nochecking if compiler supports -Wl,-rpath,... yeschecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking target system type... x86_64-unknown-linux-gnuchecking for PHP prefix... /usr/local/phpchecking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/libchecking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-zts-20131226checking for PHP installed headers prefix... /usr/local/php/include/phpchecking if debug is enabled... nochecking if zts is enabled... nochecking for re2c... noconfigure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.checking for gawk... gawkchecking for ZLIB support... yes, sharedchecking if the location of ZLIB install directory is defined... nochecking for zlib version >= 1.2.0.4... 1.2.3checking for gzgets in -lz... yeschecking for ld used by cc... /usr/bin/ldchecking if the linker (/usr/bin/ld) is GNU ld... yeschecking for /usr/bin/ld option to reload object files... -rchecking for BSD-compatible nm... /usr/bin/nm -Bchecking whether ln -s works... yeschecking how to recognize dependent libraries... pass_allchecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking dlfcn.h usability... yeschecking dlfcn.h presence... yeschecking for dlfcn.h... yeschecking the maximum length of command line arguments... 1966080checking command to parse /usr/bin/nm -B output from cc object... okchecking for objdir... .libschecking for ar... archecking for ranlib... ranlibchecking for strip... stripchecking if cc supports -fno-rtti -fno-exceptions... nochecking for cc option to produce PIC... -fPICchecking if cc PIC flag -fPIC works... yeschecking if cc static flag -static works... nochecking if cc supports -c -o file.o... yeschecking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yeschecking whether -lc should be explicitly linked in... nochecking dynamic linker characteristics... GNU/Linux ld.sochecking how to hardcode library paths into programs... immediatechecking whether stripping libraries is possible... yeschecking if libtool supports shared libraries... yeschecking whether to build shared libraries... yeschecking whether to build static libraries... nocreating libtoolappending configuration tag "CXX" to libtoolconfigure: creating ./config.statusconfig.status: creating config.h[root@BBS zlib]# make && make install/bin/sh //usr/src/temp/lamp/php-5.6.15/ext/zlib/libtool --mode=compile cc -I. -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -DPHP_ATOM_INC -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/include -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/main -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c //usr/src/temp/lamp/php-5.6.15/ext/zlib/zlib.c -o zlib.lo mkdir .libs cc -I. -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -DPHP_ATOM_INC -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/include -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/main -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c //usr/src/temp/lamp/php-5.6.15/ext/zlib/zlib.c -fPIC -DPIC -o .libs/zlib.o//usr/src/temp/lamp/php-5.6.15/ext/zlib/zlib.c:1035: warning: initialization from incompatible pointer type/bin/sh //usr/src/temp/lamp/php-5.6.15/ext/zlib/libtool --mode=compile cc -I. -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -DPHP_ATOM_INC -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/include -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/main -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c //usr/src/temp/lamp/php-5.6.15/ext/zlib/zlib_fopen_wrapper.c -o zlib_fopen_wrapper.lo cc -I. -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -DPHP_ATOM_INC -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/include -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/main -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c //usr/src/temp/lamp/php-5.6.15/ext/zlib/zlib_fopen_wrapper.c -fPIC -DPIC -o .libs/zlib_fopen_wrapper.o/bin/sh //usr/src/temp/lamp/php-5.6.15/ext/zlib/libtool --mode=compile cc -I. -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -DPHP_ATOM_INC -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/include -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/main -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c //usr/src/temp/lamp/php-5.6.15/ext/zlib/zlib_filter.c -o zlib_filter.lo cc -I. -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -DPHP_ATOM_INC -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/include -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/main -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c //usr/src/temp/lamp/php-5.6.15/ext/zlib/zlib_filter.c -fPIC -DPIC -o .libs/zlib_filter.o/bin/sh //usr/src/temp/lamp/php-5.6.15/ext/zlib/libtool --mode=link cc -DPHP_ATOM_INC -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/include -I//usr/src/temp/lamp/php-5.6.15/ext/zlib/main -I//usr/src/temp/lamp/php-5.6.15/ext/zlib -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o zlib.la -export-dynamic -avoid-version -prefer-pic -module -rpath //usr/src/temp/lamp/php-5.6.15/ext/zlib/modules zlib.lo zlib_fopen_wrapper.lo zlib_filter.lo -lzcc -shared .libs/zlib.o .libs/zlib_fopen_wrapper.o .libs/zlib_filter.o -lz -Wl,-soname -Wl,zlib.so -o .libs/zlib.socreating zlib.la(cd .libs && rm -f zlib.la && ln -s ../zlib.la zlib.la)/bin/sh //usr/src/temp/lamp/php-5.6.15/ext/zlib/libtool --mode=install cp ./zlib.la //usr/src/temp/lamp/php-5.6.15/ext/zlib/modulescp ./.libs/zlib.so //usr/src/temp/lamp/php-5.6.15/ext/zlib/modules/zlib.socp ./.libs/zlib.lai //usr/src/temp/lamp/php-5.6.15/ext/zlib/modules/zlib.laPATH="$PATH:/sbin" ldconfig -n //usr/src/temp/lamp/php-5.6.15/ext/zlib/modules----------------------------------------------------------------------Libraries have been installed in: //usr/src/temp/lamp/php-5.6.15/ext/zlib/modulesIf you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify 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 formore information, such as the ld(1) and ld.so(8) manual pages.----------------------------------------------------------------------Build complete.Don't forget to run 'make test'.Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/ 编辑php.ini添加extension=”zlib.so” 坚持原创技术分享,您的支持将鼓励我继续创作! 赏 微信打赏 支付宝打赏