为什么使用phpize?

比如刚开始安装的时候使用

./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi --with-fpm-user=nginx --with-fpm-group=nginx --without-gdbm --disable-fileinfo

哪天需要使用新的扩展了,就需要重新安装了,但是如果重新编译整个源码,就太费事了;phpize就是解决整个问题的

首先进到/home/jack/php-7.0.6/ext源码的扩展目录

然后执行:

cd standard

./configure

make

make install

Compiling shared PECL extensions with phpize

Sometimes, using the pecl installer is not an option. This could be because you're behind a firewall, or it could be because the extension you want to install is not available as a PECL compatible package, such as unreleased extensions from SVN. If you need to build such an extension, you can use the lower-level build tools to perform the build manually.

The phpize command is used to prepare the build environment for a PHP extension. In the following sample, the sources for an extension are in a directory named extname:

$ cd extname  进入到源码包中的扩展目录(就是你下载的php的源码包/home/jack/php-7.0.6/ext),这个扩展目录,通俗理解,如果要安装操作gd库,那么下载到这个库的源码后,解压源码会有个一个目录,进入这个目录。
$ phpize  运行phpize。路径不一定在这个目录下,但一般是在安装目录下(按照我理解,每个phpize与具体的版本有关,不可能通用),去寻找phpize运行。之后会生成了一个configure文件
$ ./configure     运行。    如果生成基于数据库的扩展,需要加上参数运行:1,--with-php-config。2,"--with-具体的数据库参数".比如, --with-pgsql、--with-mysql
$ make
# make install 将会生成一个extname.so的扩展,被放到了PHP extensions directory

A successful install will have created extname.so and put it into the PHP extensions directory(生成一个.so文件,自动放到php的扩展目录下去,我觉得应该是phpize能够自动侦测到php扩展目录的位置).

You'll need to and adjust php.ini and add an extension=extname.so line before you can use the extension.

If the system is missing the phpize command, and precompiled packages (like RPM's) are used, be sure to also install the appropriate devel version of the PHP package as they often include the phpize command along with the appropriate header files to build PHP and its extensions.

Execute phpize --help to display additional usage information.

phpize的作用可以这样理解:侦测环境(phpize工具是在php安装目录下,基于这点phpize对应了当时的php环境,所以是要根据该php的配置情况生成对应的configure文件),建立一个configure文件。必须在一个目录下去运行phpize。那么phpize就知道你的的环境是哪个目录,并且configure文件建立在该目录下。

步骤总结:

一、cd /usr/src/php源码包目录/ext/扩展目录/

二、/usr/local/php5314/bin/phpize

三、./configure --with-php-config=/usr/local/php5314/bin/php-config

四、make && make install

ps:make install会自动将生成的.so扩展复制到php的扩展目录下去,比如会提示已经安装到 /usr/local/php/php-5.5.18/lib/php/extensions/no-debug-non-zts-20121212/目录下去
五、剩下是配置php.ini

假如你的服务器上安装了多个版本php,那么需要告诉phpize要建立基于哪个版本的扩展。通过使用--with-php-config=指定你使用哪个php版本。

比如:--with-php-config=/usr/local/php524/bin/php-config

关于php-config文件:是在php编译生成后(安装好),放在安装目录下的一个文件。打开phpize文件内容会发现,里面定义好了php的安装目录等变量

prefix='/usr/local/php'

phpize是编译安装时候生成好的,记录了当时安装的一些信息。并不能从其他地方拿个phpize来使用。

phpize是在php安装目录下的一个文件。比如我安装了两个php5.2 和php5.3那么使用phpize也要使用对应版本的phpize才行。此时使用--with-php-config有什么作用?

phpize工具一般在哪里?

当php编译完成后,php安装目录下的bin目录下会有phpize这个脚本文件。所以是去安装好的php安装目录去找。

【转】phpize学习的更多相关文章

  1. 运行phpize失败排查

    ==相关参考== rpm包 http://rpmfind.net/linux/rpm2html/ phpize学习 ==问题及排查过程== 1.phpize失败 2.yum install php-d ...

  2. lamp环境centos5.10,phpprotobuf模块安装,及简单应用

    ==相关参考== rpm包 http://rpmfind.net/linux/rpm2html/ Linux rpm 命令参数使用详解[介绍和应用] phpize学习 http://blog.sina ...

  3. 01- Shell脚本学习--入门

    简介 Shell是一种脚本语言,那么,就必须有解释器来执行这些脚本. Unix/Linux上常见的Shell脚本解释器有bash.sh.csh.ksh等,习惯上把它们称作一种Shell.我们常说有多少 ...

  4. PHP中的Libevent学习

    wangbin@2012,1,3 目录 Libevent在php中的应用学习 1.      Libevent介绍 2.      为什么要学习libevent 3.      Php libeven ...

  5. Yaf零基础学习总结2-Yaf框架的安装

    接着上一篇文章<Yaf零基础学习总结1-Yaf框架简介>我们对Yaf框架有那么一个大概的了解了,但是对于程序员来说,那些文字都是表面的,他们最想的就是开始敲代码了.当然这也是学习Yaf框架 ...

  6. PHP 开发 APP 接口 学习笔记与总结 - Redis 缓存

    Redis 可以定期将数据备份到磁盘中(持久化),同时不仅仅支持简单的key/value 类型的数据,同时还提供list,set,hash等数据结构的存储:Memcache 只是简单的key/valu ...

  7. Laravel学习笔记(三)--在CentOS上配置Laravel

    在Laravel框架上开发了几天,不得不说,确实比较优雅,处理问题逻辑比较清楚.     今天打算在CentOS 7上配置一个Laravel,之前都是在本机上开发,打算实际配置一下.     1)系统 ...

  8. swoole深入学习 1. swoole初始

    0. 前言 swoole在PHP圈火了这么久,从2年前我用node写socket聊天服务器的时候就火了,那时候,经常有类似的文章php+swoole完爆nodejs之类的文章来吸引眼球,先不说它的好与 ...

  9. Docker 学习应用篇三:使用docker搭建的环境,安装thinksns

    Thinksns 是一个开源的社交网站,因为目前的项目需要用到这个,所以就下载一个安装试试看. 之前在windows上用了wamp,安装的很顺利.但是项目是要部署到linux上的.于是我便用了Dock ...

随机推荐

  1. HANA aggregate 数字聚合

    在project 1 里面 具有服务店代码,金额.应该上一层aggregate 就自动聚合了.可是并没有.要自己手工设置一下.在columns 右键变成——convert to  aggregated ...

  2. 二维码的扫描和生成--第三方开源--ZXing

    ZXing的二维码功能的提取lib下载地址:https://github.com/xuyisheng/ZXingLib 1.扫描二维码: 我们扫描就是要用到这个CaptureActivity类,直接把 ...

  3. Mybatis_总结_06_用_插件开发

    一.前言 Mybatis采用责任链模式,通过动态代理组织多个插件(拦截器),通过这些插件可以改变Mybatis的默认行为(诸如SQL重写之类的),由于插件会深入到Mybatis的核心,因此在编写自己的 ...

  4. 本地安装phpcms步骤

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u012145816/article/details/72183032 http://download ...

  5. Buffer 和Cache 的区别

    Buffer 和Cache 的区别buffer 与cache 操作的对象就不一样.buffer

  6. HDU3727 Jewel(主席树+树状数组(或二分))

    Problem Description Jimmy wants to make a special necklace for his girlfriend. He bought many beads ...

  7. BZOJ3745:[COCI2015]Norma

    浅谈离线分治算法:https://www.cnblogs.com/AKMer/p/10415556.html 题目传送门:https://lydsy.com/JudgeOnline/problem.p ...

  8. BZOJ2054:疯狂的馒头

    浅谈并查集:https://www.cnblogs.com/AKMer/p/10360090.html 题目传送门:https://lydsy.com/JudgeOnline/problem.php? ...

  9. 极路由U-boot解锁刷root固件教程,root后可刷华硕、如意云等多种固件,附赠全套刷软

    9008正式版固件将会封堵此漏洞,想root的同学尽快了.安装新工具箱里的root保留,可升级官方最新固件并保留root. 此方法并非本人原创,只是将root的过程和经验做个总结,比较适合菜鸟做参考, ...

  10. [置顶] 从零制作文件系统到JZ2440,使其支持telnet , ftp 和tftp

    转自:http://mp.weixin.qq.com/s?__biz=MzAxNTAyOTczMw==&mid=2649328515&idx=1&sn=5849fba4b44e ...