将 PECL 扩展库静态编译入 PHP
2012-05-14 09:12
204 查看
有时可能需要将扩展库静态编译到 PHP 中。这需要将扩展库源程序放入 php-src/ext/ 目录中去并告诉 PHP 编译系统来生成其配置脚本。
这将产生以下目录:
/your/phpsrcdir/ext/extname
此时强制 PHP 重新生成配置脚本,然后正常编译 PHP:
$ cd /your/phpsrcdir
$ rm configure
$ ./buildconf --force
$ ./configure --help
$ ./configure --with-extname --enable-someotherext --with-foobar
$ make
$ make install
Note: 要运行“buildconf”脚本,需要 autoconf 2.13 和 automake 1.4+(更新版本的 autoconf 也许能工作,但不被支持)。
是否用 --enable-extname 或 --with-extname 取决于扩展库。通常不需要外部库文件的扩展库使用 --enable。要确认的话,在 buildconf 之后运行:
$ ./configure --help | grep extname
![](http://php.chinaunix.net/images/notes-reject.gif)
![](http://php.chinaunix.net/images/notes-add.gif)
add
a noteUser Contributed Notes 将 PECL 扩展库静态编译入 PHP
There are no user contributed notes for this page.
$ cd /your/phpsrcdir/ext $ pear download extname $ gzip -d < extname.tgz | tar -xvf - $ mv extname-x.x.x extname
这将产生以下目录:
/your/phpsrcdir/ext/extname
此时强制 PHP 重新生成配置脚本,然后正常编译 PHP:
$ cd /your/phpsrcdir
$ rm configure
$ ./buildconf --force
$ ./configure --help
$ ./configure --with-extname --enable-someotherext --with-foobar
$ make
$ make install
Note: 要运行“buildconf”脚本,需要 autoconf 2.13 和 automake 1.4+(更新版本的 autoconf 也许能工作,但不被支持)。
是否用 --enable-extname 或 --with-extname 取决于扩展库。通常不需要外部库文件的扩展库使用 --enable。要确认的话,在 buildconf 之后运行:
$ ./configure --help | grep extname
![](http://php.chinaunix.net/images/notes-reject.gif)
![](http://php.chinaunix.net/images/notes-add.gif)
add
a noteUser Contributed Notes 将 PECL 扩展库静态编译入 PHP
There are no user contributed notes for this page.
相关文章推荐
- PHP 编译安装共享PECL扩展库
- 用 phpize 编译共享 PECL 扩展库
- PHP - Cannot find config.m4用 phpize 编译共享 PECL 扩展库
- PHP扩展开发之动态加载so模块与静态重编译PHP(上)
- PHP扩展开发之动态加载so模块与静态重编译PHP(下)
- 用 phpize 编译共享 PECL 扩展库
- PHP: 用 phpize 编译共享 PECL 扩展库 - Manual
- PHP: 用 phpize 编译共享 PECL 扩展库 - Manual
- Mac 下编译 PHP 扩展遇到的一些问题
- [转载~笔记]CentOS单独编译安装PHP gd库扩展
- cent os下编译安装php mongodb扩展教程
- php5.5以上版本编译扩展模块方法
- cent os下编译安装php mongodb扩展教程
- Centos 6.6(X64位)系统编译安装memcached 并安装PHP的memcache扩展
- PHP安装扩展mcrypt以及相关依赖项 【PHP安装PECL扩展的方法】
- PHP扩展-扩展的生成和编译
- php 学习编译扩展
- WAMPSERVER 64位 win7下 php 5.5.12通过 PECL 安装 zip扩展
- CentOS 编译安装 MongoDB与mongoDB的php扩展
- 【mongoDB基础篇②】PHP-mongo扩展的编译以及使用