PHP安装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服务即可。

总结

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

(0)

相关推荐

  • PHP扩展Swoole实现实时异步任务队列示例

    本文实例讲述了PHP扩展Swoole实现实时异步任务队列.分享给大家供大家参考,具体如下: 假如要发100封邮件,for循环100遍,用户直接揭竿而起,什么破网站! 但实际上,我们很可能有超过1万的邮件.怎么处理这个延迟的问题? 答案就是用异步.把"发邮件"这个操作封装,然后后台异步地执行1万遍.这样的话,用户提交网页后,他所等待的时间只是"把发邮件任务请求推送进队列里"的时间.而我们的后台服务将在用户看不见的地方跑. 在实现"异步队列"这点上,

  • php的扩展写法总结

    为什么要用C扩展 C是静态编译的,执行效率比PHP代码高很多.同样的运算代码,使用C来开发,性能会比PHP要提升数百倍.IO操作如CURL,因为耗时主要在IOWait上,C扩展没有明显优势. 另外C扩展是在进程启动时加载的,PHP代码只能操作Request生命周期的数据,C扩展可操作的范围更广. 第一步 下载PHP的源代码,如php-5.4.16.解压后进入php-5.4.16\ext目录.输入 ./ext_skel –extname=myext,myext就是扩展的名称,执行后生成myext目

  • PHP安装memcache扩展的步骤讲解

    PHP 5.6.23,查询目前最稳定的版本是memcache-2.2.7. 1.下载并解压缩. wget http://pecl.php.net/get/memcache-2.2.7.tgz tar zxvf memcache-2.2.7.tgz 2. 编译.根据实际情况使用phpize和php-config. [root@www memcache-2.2.7]# /usr/local/php/bin/phpize Configuring for: PHP Api Version: 201311

  • PHP基于mcript扩展实现对称加密功能示例

    本文实例讲述了PHP基于mcript扩展实现对称加密功能.分享给大家供大家参考,具体如下: 1.对称加密主要利用相同的密钥来实现,而非对称加密利用公钥和私钥来加密,比较而言对称加密速度快,但是安全性要低 为什么使用base64_encode(),主要是用于传参,直接加密完成后不是我们能理解的字符串,也就是大家所说的乱码 2.进行加密(使用mcript扩展,DES类型),关键点在于$key="key:1111",相同的密钥串 <?php header("content-t

  • PHP7 mongoDB扩展使用的方法分享

    前言 最近在做的项目需要将PHP5.6升级到PHP7.0,使用过PHP-mongo扩展的同学应该知道,PHP7.0的mongodb扩展是完全不兼容PHP5.6的mongo扩展的,php-mongodb改如何使用呢. 下面直接说明各种方法的使用: 1.mongodb连接: private function connect($confArr) { try{ $connStr = "mongodb://" . $confArr['host'] . ":" . $confA

  • PHP扩展mcrypt实现的AES加密功能示例

    本文实例讲述了PHP扩展mcrypt实现的AES加密功能.分享给大家供大家参考,具体如下: AES(Advanced Encryption Standard,高级加密标准)是美国联邦政府采用的一种区块加密标准.这个标准用来替代原先的DES,已经被多方分析且广为全世界所使用.Rijndael是在AES中使用的基本密码算法. 对于此算法网上流传有很多php代码实现的版本,其实php的扩展mcrypt完全支持此加密算法,不必要自己去写代码实现.先不说自己写费时费力(当然你若是想研究此加密算法,那另说)

  • PHP安装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/

  • php安装swoole扩展的方法

    本文实例讲述了php安装swoole扩展的方法.分享给大家供大家参考.具体如下: 我本机是OS X,想要安装swoole体验一下,于是: 复制代码 代码如下: andy@AndyMacBookPro:/usr/local/webdata/github$ cd swoole-src/ andy@AndyMacBookPro:/usr/local/webdata/github/swoole-src$ git pull Already up-to-date. andy@AndyMacBookPro:/

  • php安装ssh2扩展的方法【Linux平台】

    本文实例讲述了php安装ssh2扩展的方法.分享给大家供大家参考,具体如下: wget http://www.libssh2.org/download/libssh2-1.4.2.tar.gz tar -zxvf libssh2-1.4.2.tar.gz cd libssh2-1.4.2 ./configure --prefix=/usr/local/libssh2 make && make install wget http://pecl.php.net/get/ssh2-0.12.tg

  • php7安装mongoDB扩展的方法分析

    本文讲述了php7安装mongoDB扩展的方法.分享给大家供大家参考,具体如下: 这里我们使用pecl命令来安装 首先来到php7的安装目录 $ /usr/local/php7/bin/pecl install mongodb 回车,执行成功后,会输出以下结果: -- Build process completed successfully Installing '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/mongo

  • 在IIS下安装PHP扩展的方法(超简单)

    很多网上的文章在介绍IIS下安装PHP的时候都会涉及到很多配置的修改,其实大部分都是不必要的,对于需要查找如何安装PHP扩展的人来说,其实最需要的或许只是一个现在就能用的版本,在这个时候引入过多的不必要的配置我认为是低效的. 那么归纳一下其实安装步骤只需要三步: 1.下载PHP的文件包: 2.配置PHP: 3.将PHP扩展引入IIS: 当然,或许还有第4步:测试. 第一步:下载PHP PHP的windows版本是直接提供了一个压缩包,里面包括了运行所需的全部文件,堪称傻瓜式安装,可以从官网上的w

  • php7安装yar扩展的方法详解

    本文实例讲述了php7安装yar扩展的方法.分享给大家供大家参考,具体如下: 体验RPC框架Yar需要: 1. 装二进制打包协议msgpack 2. 装yar拓展和依赖 一. 安装二进制打包协议msgpack 1. 安装PHP拓展包有很多种方式,当然没什么是比pecl更加来得暴力,用这个之前要确认phpize是否存在 find / -name phpize 2. 如果phpize不存在 yum install php-devel 3. Ok,先装msgpack pecl install msgp

  • Linux下php安装Redis扩展的方法

    本文实例讲述了Linux下php安装Redis扩展的方法.分享给大家供大家参考,具体如下: 注意:目录的权限   chomd 777 -R 1.安装redis 下载:https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz 上传phpredis-2.2.4.tar.gz到/usr/local/src目录 cd /usr/local/src #进入软件包存放目录 tar zxvf phpredis-2.2.4.tar.gz #解压 cd

  • Ubuntu上安装yaf扩展的方法

    一.下载 yaf扩展下载地址 http://pecl.php.net/package/yaf 选择你想要下载的包 wget http://pecl.PHP.net/get/yaf-2.3.5.tgz tar zxvf yaf-2.3.5.tgz cd yaf-2.3.5 二.安装 #whereis phpize /data/yaf-2.3.5# /usr/bin/phpize #whereis php-config php-config: /usr/bin/php-config /usr/sha

  • PHP7.1安装yaf扩展的方法

    把PHP命令加到系统 我的PHP安装目录是/usr/local/webserver/php,所以phpize是/usr/local/webserver/php/bin/phpize,但是考虑到以后可能会用到其他命令,所以一次把该目录下的文件都做了一个软链接 ln /usr/local/webserver/php/bin/* /usr/bin/ 下载Yaf扩展包 下载对应的扩展包,Yaf3.0以上的版本是PHP7的,如果是PHP7一下的版本建议使用2.3.5的版本 mkdir -p /data/s

  • Linux centos下php安装cphalcon扩展的方法

    说明: 操作系统:CentOS php安装目录:/usr/local/php php.ini配置文件路径:/usr/local/php/etc/php.ini 1.安装cphalcon cd /usr/local/src git clone git://github.com/phalcon/cphalcon.git #需要安装安装git软件包yum install git cd /usr/local/src/cphalcon/build/php5/64bits #选择相应的php版本目录 /us

随机推荐