欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

PHP安装BCMath扩展的方法

程序员文章站 2022-07-02 12:22:08
编译安装 (php-5.6.23) 1.进入php源码包目录下的ext/bcmath目录。 [root@192 bcmath]# ls bcmath...

编译安装 (php-5.6.23)

1.进入php源码包目录下的ext/bcmath目录。

[root@192 bcmath]# ls
bcmath.c config.m4 config.w32 credits libbcmath package.xml php_bcmath.h tests

2.执行phpize命令,phpize命令在php安装目录的bin目录下,如/usr/local/php/bin/phpize。

[root@192 bcmath]# /usr/local/php/bin/phpize
configuring for:
php api version:     20131106
zend module api no:   20131226
zend extension api no:  220131226

3.执行./configure --with-php-config=/usr/local/php/bin/php-config。要依据php-config的实际路径。

[root@192 bcmath]# ./configure --with-php-config=/usr/local/php/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -e
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the c compiler works... yes
checking for c compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the gnu c compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept iso c89... none needed
checking how to run the c preprocessor... cc -e
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -r... no
checking if compiler supports -wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for php prefix... /usr/local/php
checking 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/lib
checking for php extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226
checking for php installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: warning: you will need re2c 0.13.4 or later if you want to regenerate php parsers.
checking for gawk... gawk
checking whether to enable bc style precision math functions... yes, shared
checking for ld used by cc... /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 recognize dependent libraries... pass_all
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 the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -b output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce pic... -fpic
checking if cc pic flag -fpic works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc 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
creating libtool
appending configuration tag "cxx" to libtool
configure: creating ./config.status
config.status: creating config.h

4.执行make && make install。

[root@192 bcmath]# make && make install
/bin/sh /home/tools/phptools/php-5.6.23/ext/bcmath/libtool --mode=compile cc -i/home/tools/phptools/php-5.6.23/ext/bcmath/libbcmath/src -i. -i/home/tools/phptools/php-5.6.23/ext/bcmath -dphp_atom_inc -i/home/tools/phptools/php-5.6.23/ext/bcmath/include -i/home/tools/phptools/php-5.6.23/ext/bcmath/main -i/home/tools/phptools/php-5.6.23/ext/bcmath -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 /home/tools/phptools/php-5.6.23/ext/bcmath/bcmath.c -o bcmath.lo 
mkdir .libs
 cc -i/home/tools/phptools/php-5.6.23/ext/bcmath/libbcmath/src -i. -i/home/tools/phptools/php-5.6.23/ext/bcmath -dphp_atom_inc -i/home/tools/phptools/php-5.6.23/ext/bcmath/include -i/home/tools/phptools/php-5.6.23/ext/bcmath/main -i/home/tools/phptools/php-5.6.23/ext/bcmath -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 /home/tools/phptools/php-5.6.23/ext/bcmath/bcmath.c -fpic -dpic -o .libs/bcmath.o
... ...
----------------------------------------------------------------------
libraries have been installed in:
  /home/tools/phptools/php-5.6.23/ext/bcmath/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.
don't forget to run 'make test'.
installing shared extensions:   /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

5.查询,php.ini中extension_dir配置的目录中已经有bcmath.so文件了。

[root@192 sbin]# ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
总用量 3984
-rwxr-xr-x. 1 root root 382568 10月 22 17:57 bcmath.so

6.在dynamic extensions配置块下添加一行extension=bcmath.so。

7.重启php服务即可。

PHP安装BCMath扩展的方法

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接