PHP Add extension

Source: Internet
Author: User
Tags signal handler zts



There are a lot of ways to install extensions to PHP



First, recompile



Enter the PHP source directory./configure--prefix=/usr/local/php ... [Other compilation parameters]



Ii. adding extensions via Phpize



Enter the PHP source extension application directory ext, for example:


/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/


Execute the phpize command in the Pcntl directory and then in configure, run the following result:








[[email protected] pcntl]# phpizeconfiguring for:php API version:20090626zend Module API No:20090626zend Extension Api no:220090626[[email protected] pcntl]#./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 SE D 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 Is cross compiling ... nochecking for suffix of executables ... checking for suffix of object files ... ochecking whether W  E is 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  ... nochecking for SUNCC ... nochecking whether cc UN Derstands-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 ho St 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-20090626checking 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 would need re2c 0.13.4 or later if you Want to regenerate PHP parsers.checking for gawk ... gawkchecking whether to enable PCNTL support ... yes, sharedchecking f or fork ... yeschecking for waitpid ... yeschecking for sigaction ... yEschecking for getpriority ... yeschecking for setpriority ... yeschecking for wait3 ... yeschecking for sigprocmask ... Yesch Ecking for Sigwaitinfo ... yeschecking for sigtimedwait ... 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 wh Ether ln-s works ... yeschecking how to recognize dependent libraries ... pass_allchecking for ANSI C header files ... Yesch Ecking for sys/types.h ... yeschecking for sys/stat.h ... yeschecking for stdlib.h ... yeschecking for string.h ... Yescheckin G for memory.h ... yeschecking for strings.h ... yeschecking for inttypes.h ... yeschecking for stdint.h ... yeschecking for u Nistd.h ... yeschecking dlfcn.h usability ... yeschecking dlfcn.h presence ... yeschecking for dlfcn.h ... yeschecking the max Imum 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 ...-fphecking 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 Li Braries 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 PO  Ssible ... yeschecking if Libtool supports GKFX libraries ... yeschecking whether to build shared libraries ... yeschecking Whether to build static libraries ... nocreating libtoolappending configuration Tag "CXX" to libtoolconfigure:creating./co Nfig.statusconfig.status:creating Config.hconfig.status:config.h is unchanged


After running the Make&&make install, run the results as follows:








[[email protected] pcntl]# make/bin/sh/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/libtool--mode= Compile cc-i.-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl-dphp_atom_inc-i/usr/local/src/ Ezhttp-master/soft/php-5.3.27/ext/pcntl/include-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/main-i /usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl-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/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl /pcntl.c-o pcntl.lo mkdir. Libs cc-i.-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl-dphp_atom_inc-i/usr/ local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/include-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/ pcntl/main-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl-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/local/src/EZHTTP-master /soft/php-5.3.27/ext/pcntl/pcntl.c-fpic-dpic-o. libs/pcntl.o/bin/sh/usr/local/src/ezhttp-master/soft/php-5.3.27 /ext/pcntl/libtool--mode=compile cc-i.-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl-dphp_atom_inc-i/ usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/include-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ Ext/pcntl/main-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl-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/local/src/EZHTTP-master/ Soft/php-5.3.27/ext/pcntl/php_signal.c-o Php_signal.lo cc-i.-i/usr/local/src/ezhttp-master/soft/Php-5.3.27/ext/pcntl-dphp_atom_inc-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/include-i/usr/local /src/ezhttp-master/soft/php-5.3.27/ext/pcntl/main-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl-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/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/php_signal.c-fpic-dpic-o. libs/php_signal.o/bin/sh/usr/ Local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/libtool--mode=link cc-dphp_atom_inc-i/usr/local/src/ Ezhttp-master/soft/php-5.3.27/ext/pcntl/include-i/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/main-i /usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl-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 Pcntl.la-export-dynamic-avoid-version- Prefer-pic-module-rpath/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/modules Pcntl.lo Php_signal.lo CC- Shared. libs/pcntl.o. Libs/php_signal.o-wl,-soname-wl,pcntl.so-o. Libs/pcntl.socreating pcntl.la (CD. Libs && Rm-f pcntl.la && ln-s. /pcntl.la pcntl.la)/bin/sh/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/libtool--mode=install CP./ PCNTL.LA/USR/LOCAL/SRC/EZHTTP-MASTER/SOFT/PHP-5.3.27/EXT/PCNTL/MODULESCP./.libs/pcntl.so/usr/local/src/ EZHTTP-MASTER/SOFT/PHP-5.3.27/EXT/PCNTL/MODULES/PCNTL.SOCP./.libs/pcntl.lai/usr/local/src/ezhttp-master/soft/ Php-5.3.27/ext/pcntl/modules/pcntl.lapath= "$PATH:/sbin" Ldconfig-n/usr/local/src/ezhttp-master/soft/php-5.3.27/ Ext/pcntl/modules----------------------------------------------------------------------Libraries have been Installed In:/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntl/modulEsif 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 does at least one of the followin G:-Add Libdir to the ' ld_library_path ' environment variable during execution-add libdir to the ' Ld_run_path ' Environme NT variable during linking-use the '-WL,--rpath-wl,libdir ' linker flag-have Your system administrator add Libdir to ' /etc/ld.so.conf ' See all operating system documentation about shared libraries Formore information, such as the LD (1) and L D.so (8) manual pages.----------------------------------------------------------------------Build complete. Don ' t forget to run ' make test '. [[email protected] pcntl]# make testbuild complete. Don ' t forget to run ' make test '. PHP warning:module ' pcntl ' already loaded in Unknown on line 0warning:module ' Pcntl ' already loaded in Unknown on line 0 PHP warning:module ' pcntl ' already loaded In Unknown on line 0warning:module ' Pcntl ' already loaded in Unknown on line 0========================================== ===========================php:/usr/local/php/bin/php php_sapi:cliphp_version:5.3.27zend_version:2.3.0php_os: Linux-linux qzltxx 2.6.32-279.el6.x86_64 #1 SMP Fri June 12:19:21 UTC + x86_64ini actual:/usr/local/src/ezhttp-ma Ster/soft/php-5.3.27/ext/pcntl/tmp-php.inimore. INIS:CWD:/usr/local/src/ezhttp-master/soft/php-5.3.27/ext/pcntlextra dirs:VALGRIND:Not used===================== ================================================time START 2015-01-23 08:12:17=================================== ==================================fail Test pcntl wait functionality [TESTS/001.PHPT] FAIL pcntl:pcntl_sigprocmask (), Pcntl_sigwaitinfo (), pcntl_sigtimedwait () [TESTS/002.PHPT] FAIL pcntl:sig_block, Sig_unblock, SIG_SETMASK [tests/003. PHPT] Fail Bug #47566 (return value of Pcntl_wexitstatus ()) [TESTS/BUG47566.PHPT] Fail pcntl_alarm () [Tests/pcntl_alarm.PHPT] Fail pcntl_exec () [TESTS/PCNTL_EXEC.PHPT] Fail pcntl_exec () 2 [TESTS/PCNTL_EXEC_2.PHPT] fail pcntl_exec () 3 [tests/  PCNTL_EXEC_3.PHPT] FAIL Test function pcntl_fork () by calling it with its expected arguments [TESTS/PCNTL_FORK_BASIC.PHPT]  FAIL Test function Pcntl_fork () by testing the process isolation in the forking hierarchy father, son--grandson Where father can not knows his grandson [Tests/pcntl_fork_variation.phpt] FAIL Test pcntl_get_last_error () [Tests/pcntl_g ET_LAST_ERROR.PHPT] Fail pcntl_signal () [TESTS/PCNTL_SIGNAL.PHPT] Fail Pcnt_signal_dispatch () [Tests/pcntl_signal_ DISPATCH.PHPT] Fail pcntl_wait () [TESTS/PCNTL_WAIT.PHPT] fail Closures as a signal handler [Tests/signal_closure_handler . Phpt] =====================================================================time END 2015-01-23 08:12:21========== ===========================================================test RESULT SUMMARY---------------------------------------------------------------------exts SKIPPED:0EXTS tested:29---------------------------------------------------------------------number of tests:15 15Tests skipped : 0 (0.0%)--------Tests warned:0 (0%) (0.0%) Tests failed:15 (100%) (100.0%) expected fail:0 (0%) (0.0%) Tests passed:0 (0%) (0.0%)---------------------------------------------------------------------time Taken:4 seconds================= =============================================================================================================== ==========failed test SUMMARY---------------------------------------------------------------------test pcntl wait functionality [Tests/001.phpt]pcntl:pcntl_sigprocmask (), Pcntl_sigwaitinfo (), pcntl_sigtimedwait () [Tests/002.phpt ]pcntl:sig_block, Sig_unblock, Sig_setmask [Tests/003.phpt]bug #47566 (return value of Pcntl_wexitstatus ()) [tests/ Bug47566.phpt]pcntl_alarm () [Tests/pcntl_alarm.phpt]pcntl_exec () [Tests/pcntl_exec.phpt]pcntl_exec () 2 [tests/ Pcntl_exec_2.phpt]pcntl_exec () 3 [TESTS/PCNTL_EXEC_3.PHpt]test function Pcntl_fork () by calling it and its expected arguments [Tests/pcntl_fork_basic.phpt]test function Pcntl_ Fork () by testing the process isolation in the forking hierarchy father, son--grandson where father can not know s his grandson [Tests/pcntl_fork_variation.phpt]test Pcntl_get_last_error () [Tests/pcntl_get_last_error.phpt]pcntl_ Signal () [Tests/pcntl_signal.phpt]pcnt_signal_dispatch () [Tests/pcntl_signal_dispatch.phpt]pcntl_wait () [tests/ Pcntl_wait.phpt]closures as a signal handler [tests/signal_closure_handler.phpt]=================================== ==================================you May has found a problem in PHP. This is automatically sent to the PHP QA team Athttp://qa.php.net/reports and Http://news.php.net/php.qa.report Sthis gives us a better understanding of PHP ' s behavior. If you don ' t want to send the immediately you can chooseoption "s" to save it. You can then email it to [email protected] later. Do you want to send this ReporT now? [Yns]: n[[email protected] pcntl]# make installinstalling gkfx extensions:/usr/local/php/lib/php/extensions/ no-debug-zts-20090626/


Finally, modify the php.ini configuration file, add it on the last line, and then restart Apache


Extension=pcntl.so


Third, some extensions can be added via the pecl command



For example, install the libevent extension Direct input command pecl install libevent in the directory


/usr/local/php/lib/php/extensions/no-debug-zts-20090626/


Under Generate libevent.so, and finally modify the configuration file PHP.ini (same previous method)



PHP Add extension


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.